Hello Alan, Sunday, August 22, 2004, 1:24:52 AM, you wrote:
AS> 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. AS> Not sure this is true. Doing: AS> system 'script2.pl', @ARGV; AS> works for me. ok, it works in common environment ,but not with par. Try: pp -l script.pl -o test.exe -e "system 'script.pl';" if you try to run test.exe on computer without perl installed it will not run, but dialog "open with..." appears instead. I cannt start 'script2.pl' with "system" from exe, because OS where I run exe dont know what .pl file is and has no perl interpreter. I can run: pp -l script.pl -o test.exe -l perl.exe -e "system 'perl script.pl';" to link perl.exe in exe-file but I still have problems with path to perl etc. this thema was already talking here, but still no solution found. http://www.nntp.perl.org/group/perl.par/1113 my approach was use "eval". this works with par: ... eval{ # foreign code here print "blabla"; } but if I have $code = 'print "blabla"'; I cannot evaluate this with "eval". I have got answer from Alexandr, he suggested 'require': @ARGV = ("-parameter1=foo","-parameter2=bar"); require "script2.pl"; so it working up to this code in script2.pl: $retour=`$command 2>&1`; that spawn command interpreter. So it dont working again :-(( anyway thanks! >> >> >> ########### 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 AS> 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 ?) AS> True, for a {} block. In a block, it's the one line program: AS> $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] >> -- Best regards, Pavel mailto:[EMAIL PROTECTED]
