system("$^X -w son.pl"); # it is assumed son.pl is in CWD
####
#!/home/sergei/PERL-5.10.0/bin/perl -w
use strict;
warn "this is father, \$0=$0 \$^X=$^X";
warn "father.pl: \@INC=\n", join("\n", @INC);
warn "cwd: ", `pwd`;
warn "PATH: ", `echo \$PATH`;
my @PATH = split(':', $ENV{PATH});
warn "\$PATH[0]=$PATH[0]";
warn "father.pl: \$^X=$^X";
{
warn "father.pl: about to check Perl (\$^X)";
my $cmd = "$^X -h";
warn "\$cmd=$cmd";
system($cmd);
warn "father.pl: \$?=$?";
}
####
"
./father.pl
this is father, $0=./father.pl $^X=/home/sergei/PERL-5.10.0/bin/perl at ./father.pl line 7.
father.pl: @INC=
/home/sergei/PERL-5.10.0/lib/perl5/5.10.0/i686-linux-thread-multi
/home/sergei/PERL-5.10.0/lib/perl5/5.10.0
/home/sergei/PERL-5.10.0/lib/perl5/site_perl/5.10.0/i686-linux-thread-multi
/home/sergei/PERL-5.10.0/lib/perl5/site_perl/5.10.0
. at ./father.pl line 8.
cwd: /home/sergei/junk/perl_package
PATH: /opt/kde3/bin:/home/sergei/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
$PATH[0]=/opt/kde3/bin at ./father.pl line 14.
father.pl: $^X=/home/sergei/PERL-5.10.0/bin/perl at ./father.pl line 16.
father.pl: about to check Perl ($^X) at ./father.pl line 19.
$cmd=/home/sergei/PERL-5.10.0/bin/perl -h at ./father.pl line 21.
Usage: /home/sergei/PERL-5.10.0/bin/perl [switches] [--] [programfile] [arguments]
-0[octal] specify record separator (\0, if no argument)
-a autosplit mode with -n or -p (splits $_ into @F)
-C[number/list] enables the listed Unicode features
-c check syntax only (runs BEGIN and CHECK blocks)
-d[:debugger] run program under debugger
-D[number/list] set debugging flags (argument is a bit mask or alphabets)
-e program one line of program (several -e's allowed, omit programfile)
-E program like -e, but enables all optional features
-f don't do $sitelib/sitecustomize.pl at startup
-F/pattern/ split() pattern for -a switch (//'s are optional)
-i[extension] edit <> files in place (makes backup if extension supplied)
-Idirectory specify @INC/#include directory (several -I's allowed)
-l[octal] enable line ending processing, specifies line terminator
-[mM][-]module execute "use/no module..." before executing program
-n assume "while (<>) { ... }" loop around program
-p assume loop like -n but print line also, like sed
-P run program through C preprocessor before compilation
-s enable rudimentary parsing for switches after programfile
-S look for programfile using PATH environment variable
-t enable tainting warnings
-T enable tainting checks
-u dump core after parsing program
-U allow unsafe operations
-v print version, subversion (includes VERY IMPORTANT perl info)
-V[:variable] print configuration summary (or a single Config.pm variable)
-w enable many useful warnings (RECOMMENDED)
-W enable all warnings
-x[directory] strip off text before #!perl line and perhaps cd to directory
-X disable all warnings
father.pl: $?=0 at ./father.pl line 23.
".
####
"
(export PATH=/opt/kde3/bin:/home/sergei/bin:/usr/local/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin;./father)
this is father, $0=./father $^X=perl at script/father.pl line 7.
father.pl: @INC=
/tmp/par-sergei/cache-e0cd5bf94ffa04802f4f5c756f59f68f58993e95/inc/lib
/tmp/par-sergei/cache-e0cd5bf94ffa04802f4f5c756f59f68f58993e95/inc
CODE(0x8736488)
CODE(0x87367d8) at script/father.pl line 8.
cwd: /home/sergei/junk/perl_package
PATH: /tmp/par-sergei/cache-e0cd5bf94ffa04802f4f5c756f59f68f58993e95:/opt/kde3/bin:/home/sergei/bin:/usr/local/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
$PATH[0]=/tmp/par-sergei/cache-e0cd5bf94ffa04802f4f5c756f59f68f58993e95 at script/father.pl line 14.
father.pl: $^X=perl at script/father.pl line 16.
father.pl: about to check Perl ($^X) at script/father.pl line 19.
$cmd=perl -h at script/father.pl line 21.
father.pl: $?=-1 at script/father.pl line 23.
"