Dispatch/Email/MailSendmail.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Dispatch/Email/MailSend.pm ↑ Summary Dispatch/Email/MailSender.pm »
1 package Log::Dispatch::Email::MailSendmail;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 our $VERSION = '2.71';
7  
8 0 ▶use Mail::Sendmail ();
Subroutine BEGIN: called CC=1 SCAR=2.6
9  
10 use base qw( Log::Dispatch::Email );
11  
12 sub send_email {
13 my $self = shift;
14 my %p = @_;
15  
16 my %mail = (
17 To => ( join ',', @{ $self->{to} } ),
18 Subject => $self->{subject},
19 Message => $p{message},
20  
21 # Mail::Sendmail insists on having this parameter.
22 From => $self->{from} || 'LogDispatch@foo.bar',
23 );
24  
25 local $? = 0;
26 unless ( Mail::Sendmail::sendmail(%mail) ) {
27 warn "Error sending mail: $Mail::Sendmail::error";
28 }
29 }
30  
31 1;
32  
33 # ABSTRACT: Subclass of Log::Dispatch::Email that uses the Mail::Sendmail module
34  
35 __END__
« Dispatch/Email/MailSend.pm ↑ Summary Dispatch/Email/MailSender.pm »