Carp::Mailer - Traps die and warn signals and dispatch emails to someone.
Igor Sutton Lopes <igor@izut.com>
Use it to notify someone if an error occurrs in your application.
use Carp::Mailer ( recipients => [qw/igor@izut.com/], subject => "%s execution had errors! Check it!", )
Text::Template, Mail::Mailer
Carp::Mailer is an error reporting module. It will trap any warn or die signals and then dispatch an email to specified recipients the message the signal threw.
warn
die
Must be a list reference to all recipients the errors should be sent.
Example
use Carp::Mailer ( recipients => [qw/first@domain.com second@domain.com/], );
The format of the subject the message will have. The placeholder %s will be substituted by the application's file path.
%s
use Carp::Mailer ( subject => "An error occurred when executing %s"; );
The format of the body the message will have. At this time, it's available only {$application} and {$message} placeholders.
{$application}
{$message}
use Carp::Mailer ( message => 'An error occurred while executing {$application}:\n\n{$message}', );
The method Mail::Mailer will use to deliver the messages. Check Mail::Mailer documentation to check the available methods.
use Carp::Mailer ( method => 'sendmail', );
This option is used if the method option was set as smtp. It specifies the mail relay server Mail::Mailer will use to deliver the messages.
use Carp::Mailer ( method => 'smtp', relay => 'mail.domain.com', );
To install Carp::Mailer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Carp::Mailer
CPAN shell
perl -MCPAN -e shell install Carp::Mailer
For more information on module installation, please visit the detailed CPAN module installation guide.