in reply to Debugging Perl .cgi forms
The next time you run into this kind of problem, try CGI::Debug (available from the CPAN). This module seems to do a very fine job of digging out diagnostics that normally cause internal server errors. It can e-mail the diagnostic output to you, which is a neat feature when you don't have permission to read the error logs.
A neat trick that I've used a few times is to wrap a perl compile/syntax check in a shell wrapper, with stderr redirected to stdout:
#!/bin/sh echo -ne "Content-type: text/plain\n\n" perl -cw myscript 2>&1 echo -ne "\nsyntax check complete\n"
Configure the shell script and request its URL just as you would any CGI program, and the output from perl -cw will be sent to your client.
This will help you catch problems like a shebang line in your script that specifies the wrong location for the perl executable, as well as the usual assortment of errors that can show up when your script is run in an environment other than the one in which it was written and tested.
Not all servers are configured to allow shell scripts to to talk to the CGI, but when this method works it's very useful.
|
|---|