On Fri, Jul 25, 2014 at 7:55 AM, Bagdevi <bagdevi.mis...@gmail.com> wrote:
> system ("perl a.pl"); > There are several things wrong with this: - You assume that a.pl is in your current working directory - that doesn't have to be the case even in the unpacked case. In the packed case a.pl etc will be located in a temporary cache directory, "$ENV{PAR_TEMP}/inc/script" - You assume that master.pl was invoked from an executable called "perl" (or "perl.exe" on Windows) that can be found via $PATH - what if it's not in your path and you called it with an absolute pathname? What if it's not even called "perl", but "perl5.18" or similar? Always use $^X which is the absolute pathname of the Perl interpreter that is executing the current script. - When packing, you must use "pp --reusable ..." for your scenario to work. Putting all this together: ==> a.pl <== #!/usr/bin/perl use File::Spec; my $script_dir = File::Spec->catdir($ENV{PAR_TEMP}, qw(inc script)); print STDERR "this is a.pl\n", "\$script_dir = $script_dir\n"; "\$^X = $^X\n"; print STDERR "running b.pl ...\n"; system $^X, File::Spec->catfile($script_dir, "b.pl"); print STDERR "running c.pl ...\n"; system $^X, File::Spec->catfile($script_dir, "c.pl"); print STDERR "a.pl done\n"; ==> b.pl <== #!/usr/bin/perl print STDERR "this is b.pl\n"; ==> c.pl <== #!/usr/bin/perl print STDERR "this is c.pl\n"; ... pack it... $ pp --reusable -o foo.exe a.pl b.pl c.pl ...run it $ ./foo.exe this is a.pl $script_dir = /tmp/par-726f646572696368/cache-2a74a667f0a6e1a744c1654f442a69b2b563f710/inc/script running b.pl ... this is b.pl running c.pl ... this is c.pl a.pl done Cheers, Roderich