Perrin Harkins wrote:
I'm not sure if that's accurate or not, but setting a $SIG{__DIE__}
handler should work fine.
You don't even need to use a __DIE__ handler. mod_perl will place any runtime
errors into $r->notes('error-notes'). I don't like my errors going to the
browser (only really works if your content is HTML anyway) but for the email I
usually use an Apache cleanup handler. That way it gets sent after the client
request has returned, so they don't have to wait on it.
I use something like this:
# in httpd.conf where you need it
PerlCleanupHandler MyProject::ApacheCleanup
# in MyProject/ApacheCleanup.pm
package MyProject::ApacheCleanup;
use Apache::Constants qw(:common);
sub handler ($$) {
my ($class, $r) = @_;
return DECLINED unless $r->is_main;
my $status = $r->last->status;
return DECLINED unless $status == SERVER_ERROR;
my $error = $r->notes('error-notes') || $ENV{ERROR_NOTES};
return DECLINED unless $error;
# create your email message and send it. I also like to put in a
# Data::Dumper dump of %ENV, the URL, timestamp and other project
# specific config settings
return DECLINED;
}
--
Michael Peters
Plus Three, LP