logo       

Re: run perl script from PAR: msg#00032

Subject: Re: run perl script from PAR
On 22 Aug 2004 at 0:20, Pavel wrote:

> Hello
> 
> I am trying to start perl script from PAR
> script1.pl that runs without parameters and was converted to exe
> 
> script2.pl runs with parameters and should have the same environment
> as script1.pl
> 
> I cannot chande or modify script2.pl so I need use it "as is"
> 
> "system", "exec", and using of `` dont help me because they start new
> process in another enviroment etc.

Not sure this is true. Doing:

    system 'script2.pl', @ARGV;

works for me.

> 
> 
> ########### script1.pl ################
> use warnings;
> use strict;
> my $script;
> 
> # read content of script2.pl
> open(S,"script2.pl");
> {local $/=undef;$script=<S>};
> close S;
> 
> # feed parameters for script2.pl
> @ARGV = ("-parameter1=foo","-parameter2=bar");
> 
> eval{$script};        # trying to eval content of $script

   eval $script;      # eval the string expr, not a block

> print $@ if $@;
> #########################################
> 
> for test purpose script2.pl can be:
> 
> ############ script2.pl ################
> use sctrict;
> use warnings;
> foreach(@ARGV){
>     print $_."\n";
> }
> ###########################################
> 
> this dont work - (perl dont evaluate content but variable itself ?)

True, for a {} block. In a block, it's the one line program:

    $script;

> 
> I get warnings "Useless use of private variable in void context at.."
> and no output.
> 
> can somebody give me a hint?
> 
> 
> thanks
> 
> 
> 
> -- 
> Best regards,
>  Pavel                            mailto:du4mi@xxxxxx
> 





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe