CGI Header Problem
- Hi all,
I'm trying to get a CGI script working on my webserver. When running the script from the command line, there is no problem. When running it on the webserver via a browser, I get the following error in the server error log:
trying to POST /~ds6601/cgi-bin/perldoc.cgi, cgi_scan_headers reports: the CGI program /export/home/ds6601/public_html/cgi-bin/perldoc.cgi did not produce a valid header (name without value: got line "name")
The browser, of course, just reports a 500 error.
I tried using CGI::Carp qw (fatalsToBrowser) in the script, and then finished each line with an "or die..." line, but that changed nothing. I assume it has something to do with the header created by the CGI module, but I'm not sure. If anyone could tell me what's causing the error, I'd appreciate it.
Script is below. At this point, I'm less concerned about beauty & efficiency than I am about results. Although, if anyone knows of a better way to get a web server to generate the perldoc output for a given function or module, I'm all ears.
# Script perldoc.cgi
use CGI::Carp qw(fatalsToBrowser);
# A script to print out the perldoc for any module
# or function.
my $query = new CGI::Pretty;
print $query->start_html("Perldoc Form");
print $query->h1("Perldoc Form");
print "<EM>Enter the function name you are searching for</EM><BR>";
print $query->submit('Action', 'Print it');
my $function = $query->param('group_name');
my $name = $query->param('functionname');
print "You requested the perldoc output for: ",$name;
if ( $function eq 'isfunction' )
my @perldocarray = `/appl/perl/bin/perldoc -f $name`;
my @perldocarray = `/appl/perl/bin/perldoc $name`;
foreach my $line (@perldocarray)
print $line, "<BR>\n";