This is my attempt to cut through extraneous issues raised "Why don’t my system calls work in the Perl program I wrap with pp?" I have created a simple Perl script on a linux system:
new-net:~/scripts # cat ls_test.pl
@ls_out = `ls -l`;
map { print "$_
" } @ls_out;
$out = `sh out_test.sh`;
print "$out
";
This script calls a simple shell file:
new-net:~/scripts # cat out_test.sh
echo "I'm here"
I used pp to pack the Perl script along with the shell script into ls_test:
new-net:~/test # unzip -l ls_test
Archive: ls_test
Length Date Time Name
-------- ---- ---- ----
0 07-13-09 16:41 script/
436 07-13-09 16:41 MANIFEST
214 07-13-09 16:41 META.yml
93 07-13-09 16:41 script/ls_test.pl
538 07-13-09 16:41 script/main.pl
16 07-13-09 16:20 out_test.sh
-------- -------
1297 6 files
If I run the packed file in an otherwise empty directory, the shell script is not found:
new-net:~/test # ./ls_test
total 3391
-rwxr-xr-x 1 root root 3466177 Jul 13 16:41 ls_test
sh: out_test.sh: No such file or directory
If I copy the shell script into the directory, the packed script runs as expected:
new-net:~/test # ./ls_test
total 3395
-rwxr-xr-x 1 root root 3466177 Jul 13 16:41 ls_test
-rw-r--r-- 1 root root 16 Jul 13 16:20 out_test.sh
I'm here
So, where does a pp
packed script expect to find an included file? And how should a call to that included file be configured in the original Perl script?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…