blib/lib/Test/Smoke/Mailer/Mail_Sendmail.pm

filter: Statementstmt 39.2% 11 / 28 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 25.0% 15 / 60 CC 13 SCAR 50.0
CC
13
Cov
21%
mail
182.0
BEGIN
1.0
BEGIN
1.0
CRAP 148.1
« blib/lib/Test/Smoke/App/SmokeStatus.pl ↑ Summary blib/lib/Test/Smoke/App/ConfigSmoke.pm »
1 package Test::Smoke::Mailer::Mail_Sendmail;
2 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 our $VERSION = '0.016';
6  
7 3 ▶use base 'Test::Smoke::Mailer::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 Test::Smoke::Mailer::Mail_Sendmail
10  
11 This handles sending the message using the B<Mail::Sendmail> module.
12  
13 =head1 DESCRIPTION
14  
15 =head2 Test::Smoke::Mailer::Mail_Sendmail->new( %args )
16  
17 Keys for C<%args>:
18  
19 * ddir
20 * mserver
21 * to
22 * from
23 * cc
24 * v
25  
26 =cut
27  
28 =head2 $mailer->mail( )
29  
30 C<mail()> sets up the message to be send by B<Mail::Sendmail>.
31  
32 =cut
33  
34 0 ▶sub mail {
Subroutine mail: not called CC=13 SCAR=52.0
Pod documented
35 0 my $self = shift;
36  
37 0 eval { require Mail::Sendmail; };
38  
39 0 ▶ $self->{error} = $@ and return undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"error"} = $@ and return undef 0 0 0
40  
41 0 my $subject = $self->fetch_report();
42 0 my $cc = $self->_get_cc( $subject );
43  
44 my %message = (
45 To => $self->{to},
46 Subject => $subject,
47 Body => $self->{body},
48 0 );
49 0 ▶ $message{cc} = $cc if $cc;
Branch: 1 branch
BranchTrueFalseTotal
if $cc 0 0 0
50 0 ▶ $message{bcc} = $self->{bcc} if $self->{bcc};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"bcc"} 0 0 0
51 0 ▶ $message{from} = $self->{from} if $self->{from};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"from"} 0 0 0
52 0 ▶ $message{smtp} = $self->{mserver} if $self->{mserver};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"mserver"} 0 0 0
53  
54 $message{ 'Content-type' } = qq!text/plain; charset="UTF8"!
55 0 ▶ if exists $ENV{LANG} && $ENV{LANG} =~ /utf-?8$/i;
Branch: 1 branch
BranchTrueFalseTotal
if exists $ENV{"LANG"} and $ENV{"LANG"} =~ /utf-?8$/i 0 0 0
Condition0%0/3
exists $ENV{"LANG"} and $ENV{"LANG"} =~ /utf-?8$/i
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ENV{"LANG"} and $ENV{"LANG"} =~ /utf-?8$/i
exists $ENV{"LANG"} $ENV{"LANG"} =~ /utf-?8$/i
Truth table0%0/3
A and B
A= exists $ENV{"LANG"}B= $ENV{"LANG"} =~ /utf-?8$/i
ABresult
0X0
100
111
56  
57 0 ▶ $self->{v} > 1 and print "[Mail::Sendmail]\n";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"v"} > 1 and print "[Mail::Sendmail]\n" 0 0 0
58 0 ▶ $self->{v} and print "Sending report to $self->{to} ";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"v"} and print qq[Sending report to $self->{"to"} ] 0 0 0
59  
60 Mail::Sendmail::sendmail( %message ) or
61 0 ▶ $self->{error} = $Mail::Sendmail::error;
Branch: 1 branch
BranchTrueFalseTotal
Mail::Sendmail::sendmail(%message) or $self->{"error"} = $Mail::Sendmail::error 0 0 0
62  
63 0 ▶ $self->{v} and print $self->{error} ? "not OK\n" : "OK\n";
Branch: 2 branches
BranchTrueFalseTotal
$self->{"v"} and print $self->{"error"} ? "not OK\n" : "OK\n" 0 0 0
$self->{'error'} ? : 0 0 0
64  
65 0 return ! $self->{error};
66 }
67  
68 3 1;
69  
70 =head1 COPYRIGHT
71  
72 (c) 2002-2013, All rights reserved.
73  
74 * Abe Timmerman <abeltje@cpan.org>
75  
76 This library is free software; you can redistribute it and/or modify
77 it under the same terms as Perl itself.
78  
79 See:
80  
81 * <http://www.perl.com/perl/misc/Artistic.html>,
82 * <http://www.gnu.org/copyleft/gpl.html>
83  
84 This program is distributed in the hope that it will be useful,
85 but WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
87  
88 =cut
« blib/lib/Test/Smoke/App/SmokeStatus.pl ↑ Summary blib/lib/Test/Smoke/App/ConfigSmoke.pm »