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:[EMAIL PROTECTED]
> 


Reply via email to