Reputation: 83
I want to run a script from my website using CGI.pm - The script I am running is usally ran from the command line and requires several command line ARGV inputs. How do I deal with this using CGI.pm? - can I insert a system($command) into Perl CGI script? The script can be seen here - http://www.ncbi.nlm.nih.gov/IEB/ToolBox/C_DOC/lxr/source/doc/blast/web_blast.pl
Upvotes: 0
Views: 286
Reputation: 928
You can dual-purpose the script by checking if you are connected to a terminal:
if (-t STDOUT) {
# Command LIne mode, use @ARGV;
}
else {
# CGI mode, get ARGV equivalent from CGI->param
}
You will have to adjust the output to work in CGI mode, by adding content headers before you output anything.
If you use system($foo)
in a web page, make sure the logic controlling what's in $foo
is secure, otherwise you might end up hacked.
Upvotes: 1
Reputation: 386706
how to collect ARGV using Perl CGI?
@ARGV
didn't go anywhere, but CGI doesn't use command line arguments, so there are no command line arguments to collect.
can I insert a
system($command)
into Perl CGI script?
Yes.
Upvotes: 2