0
votes

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

2

2 Answers

2
votes

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.

1
votes

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.