Dispatch/Email/MIMELite.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/Handle.pm ↑ Summary Dispatch/Email/MailSend.pm »
1 package Log::Dispatch::Email::MIMELite;
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 MIME::Lite;
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 Type => 'TEXT',
20 Data => $p{message},
21 );
22  
23 $mail{From} = $self->{from} if defined $self->{from};
24  
25 local $? = 0;
26 unless ( MIME::Lite->new(%mail)->send ) {
27 warn 'Error sending mail with MIME::Lite';
28 }
29 }
30  
31 1;
32  
33 # ABSTRACT: Subclass of Log::Dispatch::Email that uses the MIME::Lite module
34  
35 __END__
« Dispatch/Handle.pm ↑ Summary Dispatch/Email/MailSend.pm »