Okay I have an odd question here. I have a Perl script that runs from the
command line, accepting arguments, i.e.
'perl text2html.pl --d=01/04/2001 --input=data.txt --file_name=foo.html'. I
want to be able to activate it via the Web from a form that I wrote using
the CGI.pm module.
The user will file in the form and when the form is submitted it will
activate the text2html.pl script using the values from the form as command
line arguments.
How do I get these values passed to the text2html.pl script? Right now I am
just printing the values input to the form at the bottom of the page so I
know that the form is accepting them.
Would I use something like the following?
if (defined($ENV{'QUERY_STRING'})) {
my $CGI = new CGI;
my $command_line_arg_1 = $CGI->param('c');
my $command_line_arg_2 = $CGI->param('d');
my $command_line_arg_3 = $CGI->param('i');
my $command_line_arg_4 = $CGI->param('cbn');
my $command_line_arg_5 = $CGI->param('cbp');
my $command_line_arg_6 = $CGI->param('pbn');
my $command_line_arg_7 = $CGI->param('pba');
} else {
my $command_line_arg_1 = $argv[0];
my $command_line_arg_2 = $argv[1];
my $command_line_arg_3 = $argv[2];
my $command_line_arg_4 = $argv[3];
my $command_line_arg_5 = $argv[4];
my $command_line_arg_6 = $argv[5];
my $command_line_arg_7 = $argv[6];
}
Where exactly would this go?
Thanks,
- Domenic