in reply to mod_perl: how to display the error message within the ErrorDocument

Instead of Apache::Error, you might consider CGI::Carp. This would have to be done at the script level rather than the server level. There is an option with CGI::Carp that will allow you to both display the server error reason on the screen in HTML and also e-mail the error to a specified e-mail address. For instance:
Contents of CatchErrors.pm follows: ----------------------------------- use strict; use CGI::Carp qw(fatalsToBrowser set_message); use Mail::Sender; BEGIN { sub email_problem { my $sender = new Mail::Sender({ from => 'errors@yourdomain.com', smtp => 'smtp.server.com'}); $sender->MailMsg({ to => $Error::email, subject => $ENV{SCRIPT_NAME}, msg => $_[0]}); print "Website Error"; } set_message(\&email_problem); } sub import { $Error::email = $_[1] || 'errors@yourdomain.com'; } 1; -------------------------------------- Then, in your perl script, simply include the following line: use CatchErrors qw(recipient@yourdomain.com);
Using this method, you should be able to redirect all of the script's errors to an e-mail address you specify when you "use" the package.
  • Comment on Re: mod_perl: how to display the error message within the ErrorDocument
  • Download Code