1 - make sure your syntax works from a command prompt
Code:
C:\perl -c your_code.cgi =return=
That will check your syntax without running the code.
2 - Instead of using the 'die' function, use a small
sub routine to report errors. Like,
open(FILE,"<Some_file" or oooops("Failed to open Some_file, $!"
while(<FILE>)....
close FILE;
sub oooops
{
my $error = shift;
print "<p>$error</p></body></html>";
exit;
}
Use something like this everywhere you MIGHT have a significant failure (eg. opening a file).
3 - You can run your CGI from a command prompt. Obviously,
if the output is really large then this becomes a little
tedious, but, it will allow you to see the output of your
code.
'hope this helps
If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
If you must run in a browser this line will help on Apache servers
#######REMOVE LATER
use CGI::Carp qw(fatalsToBrowser);
This dumps errors out to the browser instead of the serverlog. It may help.. On IIS servers the browser is defaulted as the area to dump errors.
SERVER 500 ERROR!
There are several reasons for it but the most common one is a script inabilty to find a file that is requested by 'use' or 'require' statements. Check these statments to make sure all the paths are correct.
Beware the dreded typo in the path.
I agree with goboatings ideas, make sure the syntax is ok first.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.