For a project at work, I need to call one Perl/CGI script from another. An extremely simplified version of that script that I'm using for testing is here (the real scripts don't use recursion, but this way I don't have to copy & paste a lot of code):
#!/usr/local/bin/perl
use CGI qw(:standard);
use POSIX 'setsid';
$|=1;
print "Content-type: text/html\n\n";
@names = param;
print "@names";
if(defined(param('submit'))){
#delete_all();
system('perl testParams.pl abc=123');
exit(0);
} else{
print "NO SUBMIT PARAM";
}
What this script is supposed to do:
- Print names of all parameters.
- If a submit parameter is defined, run the script again but with a parameter called "abc".
- If a "submit" parameter is not defined, print "NO SUBMIT PARAM".
What the script actually does:
- Print names of all parameters.
- If a "submit" parameter is defined, run the script again with the same parameters that the original script was run with.
- If a "submit" parameter is not defined, print "NO SUBMIT PARAM".
Any idea what's causing Perl/CGI to ignore the new parameters and instead send the old ones when running the script?