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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.