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

filter: Statementstmt 39.2% 11 / 28 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 26.7% 15 / 56 CC 11 SCAR 46.4
CC
11
Cov
22%
mail
132.0
BEGIN
1.0
BEGIN
1.0
CRAP 103.9
« blib/lib/Test/Smoke/Smoker.pm ↑ Summary blib/lib/Test/Smoke/App/ConfigSmoke/Scheduler.pm »
1 package Test::Smoke::Mailer::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::Sendmail
10  
11 This handles sending the message by piping it to the B<sendmail> program.
12  
13 =head1 DESCRIPTION
14  
15 =head2 $mailer->mail( )
16  
17 C<mail()> sets up a header and body and pipes them to the B<sendmail>
18 program.
19  
20 =cut
21  
22 0 ▶sub mail {
Subroutine mail: not called CC=11 SCAR=48.8
Pod documented
23 0 my $self = shift;
24  
25 0 my $subject = $self->fetch_report();
26 0 my $cc = $self->_get_cc( $subject );
27 0 my $header = "To: $self->{to}\n";
28 $header .= "From: $self->{from}\n"
29 0 ▶ if exists $self->{from} && $self->{from};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"from"} and $self->{"from"} 0 0 0
Condition0%0/3
exists $self->{"from"} and $self->{"from"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"from"} and $self->{"from"}
exists $self->{"from"} $self->{"from"}
Truth table0%0/3
A and B
A= exists $self->{"from"}B= $self->{"from"}
ABresult
0X0
100
111
30 0 ▶ $header .= "Cc: $cc\n" if $cc;
Branch: 1 branch
BranchTrueFalseTotal
if $cc 0 0 0
31 0 ▶ $header .= "Bcc: $self->{bcc}\n" if $self->{bcc};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"bcc"} 0 0 0
32 0 $header .= "Subject: $subject\n\n";
33  
34 0 ▶ $self->{v} > 1 and print "[$self->{sendmailbin} -i -t]\n";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"v"} > 1 and print qq[[$self->{"sendmailbin"} -i -t]\n] 0 0 0
35 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
36 0 local *MAILER;
37 0 ▶ if ( open MAILER, "| $self->{sendmailbin} -i -t " ) {
Branch: 1 branch
BranchTrueFalseTotal
if (open MAILER, "| $self->{'sendmailbin'} -i -t ") { } 0 0 0
38 0 print MAILER $header, $self->{body};
39 close MAILER or
40 0 ▶ $self->{error} = "Error in pipe to sendmail: $! (" . $?>>8 . ")";
Branch: 1 branch
BranchTrueFalseTotal
close MAILER or $self->{"error"} = "Error in pipe to sendmail: $! (" . $? >> "8)" 0 0 0
41 } else {
42 0 $self->{error} = "Cannot fork ($self->{sendmailbin}): $!";
43 }
44 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
45  
46 0 return ! $self->{error};
47 }
48  
49 3 1;
50  
51 =head1 COPYRIGHT
52  
53 (c) 2002-2013, All rights reserved.
54  
55 * Abe Timmerman <abeltje@cpan.org>
56  
57 This library is free software; you can redistribute it and/or modify
58 it under the same terms as Perl itself.
59  
60 See:
61  
62 * <http://www.perl.com/perl/misc/Artistic.html>,
63 * <http://www.gnu.org/copyleft/gpl.html>
64  
65 This program is distributed in the hope that it will be useful,
66 but WITHOUT ANY WARRANTY; without even the implied warranty of
67 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
68  
69 =cut
« blib/lib/Test/Smoke/Smoker.pm ↑ Summary blib/lib/Test/Smoke/App/ConfigSmoke/Scheduler.pm »