[GLLUG] CGI/Perl Script
Dpk
dpk@egr.msu.edu
Tue, 20 Aug 2002 10:28:19 -0400
On Tue, Aug 20, 2002 at 10:16:27AM -0400, Daniel wrote:
Sure thing. Here:
#!/usr/bin/perl
require "./cgi-lib.pl";
print &PrintHeader;
&ReadParse(*input);
$path1=$input{'path1'};
$path2=$input{'path2'};
{do whatever you need with the input here}
Then, when you call the cgi, pass the args as:
http://blah.woof.com/foo.cgi?path1=firstpart&path2=secondpart
Is this what you need? (I suck at perl, so feel free to point out
any mistakes I made here)
Personally, I would avoid using cgi-lib.pl. It is non-standard and
isn't as scalable as CGI.pm.
#!/usr/bin/perl -T
use CGI qw/:standard *table/;
my $path1 = url_param('path1');
my $path2 = url_param('path2');
With user defined paths, make sure you use taint perl (the -T switch)
and do heavy data scrubbing before passing to the system. If at all
possible, I would avoid using a user defined path to a file
altogether.
Adam, I'm suprised you posted this request when you have 1000s of
lines of wonderfully written CGI/perl code at your disposal here at
work :)
Dpk