$msg
$outer_message END ; if ($mod_perl && (my $r = Apache->request)) { # If bytes have already been sent, then # we print the message out directly. # Otherwise we make a custom error # handler to produce the doc for us. if ($r->bytes_sent) { $r->print($mess); $r->exit; } else { $r->status(500); $r->custom_response(500,$mess); } } else { print STDOUT $mess; } } elsif ($@) { # If not in $DEBUG_MODE rethrow error die ($@); } # # SOME EXTRA TECHNICAL NOTES FOR THOSE INTERESTED: # # This script was inspired from Matt Sergeant's # addition to the mod_perl guide where he # explained why catching $SIG{__DIE__} as # well as using CGI::Carp qw(fatalsToBrowser) # does not really work except in the simplest # of situations. # # Thus, we have switched to using this debug script # as a means to catching exceptions on the fly # and outputting them to the browser. # # The mod_perl guide can be found at # http://perl.apache.org/ # #