When an ordinary cgi script executes a "die" command in the script, =
Apache
displays an Internal Server Error page to the user and Perl writes an =
error
message to STDERR (the error log).
The die command might be encountered if a file can't be opened, for =
example:
open(INFILE, "/www/data/users.txt") or die("Can't open =
/www/data/users.txt
for reading, stopped $!");
When the same cgi script is run under PersistentPerl, though, the die =
command
doesn't write an error message to the error log. Instead the error log =
merely
indicates that there were malformed headers from the script. (The =
"Can't open
/www/data/users.txt for reading" message goes off into the ether =
somewhere.)
The same thing occurs when using an ordinary Perl die command in a cgi =
script
that's run under mod_perl, but mod_perl has a way for the script to =
write a
meaningful message to the error log, such as:
my $fh;
unless ($fh =3D Apache::File->new($file)) {
$r->log_error("Couldn't open $file for reading, stopped $!");
return SERVER_ERROR;
}
Does PersistentPerl have a similar method or technique that should be =
used in
lieu of a Perl die command, so that an error will be logged to STDERR =
before the
script dies?
Thanks,
Dave Baker
|