Internal Server Errors

Die statements

If your script opens files like this:

open (F, "myfile.txt");
@lines=<F>;
close (F);

then you need to do something about it! If at any stage the script can't open the file, this can lead to problems. Either a script can sit there hanging if it can't open and write to a file, or you can spend ages trying to work out exactly why your script isn't doing what it should be.

If there's a problem with sendmail, or the path to sendmail is wrong - it will end the script and return the error:

Unable to open sendmail. No such file or directory at test.cgi line 311.

It is recommended that you go right through your script and put 'die' statements in wherever the script tries to open up a file. It does two things: lets you know that there's a problem, as well as killing off the execution of the script instead of letting it keep trying forever to open a file that doesn't exist.