in reply to Is there a CGI::Carp fatalstoEmail ?
use CGI::Carp qw/ fatalsToBrowser set_message /; use Mail::Mailer; BEGIN { sub fatalsToEmail { my $error = shift; my $smtp = Mail::Mailer->new('smtp', Server => '127.0.0.1'); $smtp->open({ 'To' => 'you@yourdomain.com', 'From' => 'you@yourdomain.com' }); print $smtp $error; $smtp->close; } set_message(\&fatalsToEmail); }
As outlined in the CGI::Carp man page, the set_message routine should be called from within a BEGIN in order to correctly interpret compile-time errors.
|
|---|