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

filter: Statementstmt 39.2% 11 / 28 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 25.0% 15 / 60 CC 12 SCAR 48.3
CC
12
Cov
22%
mail
156.0
BEGIN
1.0
BEGIN
1.0
CRAP 125.0
« blib/lib/Test/Smoke/App/ConfigSmoke.pm ↑ Summary blib/lib/Test/Smoke/Smoker.pm »
1 package Test::Smoke::Mailer::Mail_X;
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_X
10  
11 This handles sending the message with either the B<mail> or B<mailx> program.
12  
13 =head1 DESCRIPTION
14  
15 =head2 Test::Smoke::Mailer::Mail_X->new( %args )
16  
17 Keys for C<%args>:
18  
19 * ddir
20 * mailbin/mailxbin
21 * to
22 * cc
23 * v
24  
25 =cut
26  
27 =head2 $mailer->mail( )
28  
29 C<mail()> sets up the commandline and body and pipes it to either the
30 B<mail> or the B<mailx> program.
31  
32 =cut
33  
34 0 ▶sub mail {
Subroutine mail: not called CC=12 SCAR=50.5
Pod documented
35 0 my $self = shift;
36  
37 0 ▶ my $mailer = $self->{mailbin} || $self->{mailxbin};
Condition0%0/3
$self->{'mailbin'} || $self->{'mailxbin'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'mailbin'} || $self->{'mailxbin'}
$self->{'mailbin'} $self->{'mailxbin'}
Truth table0%0/3
A || B
A= $self->{'mailbin'}B= $self->{'mailxbin'}
ABresult
1X1
011
000
38  
39 0 my $subject = $self->fetch_report();
40 0 my $cc = $self->_get_cc( $subject );
41  
42 0 my $cmdline = qq|$mailer -s '$subject'|;
43 0 ▶ $self->{swcc} ||= '-c', $cmdline .= qq| $self->{swcc} '$cc'| if $cc;
Branch: 1 branch
BranchTrueFalseTotal
if $cc 0 0 0
Condition0%0/2
$self->{"swcc"} ||= "-c"
l!l
00
MC/DC0%0/1
$self->{"swcc"} ||= "-c"
$self->{"swcc"}
Truth table0%0/2
A
A= $self->{"swcc"}
Aresult
11
00
44 $self->{swbcc} ||= '-b', $cmdline .= qq| $self->{swbcc} '$self->{bcc}'|
45 0 ▶ if $self->{bcc};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"bcc"} 0 0 0
Condition0%0/2
$self->{"swbcc"} ||= "-b"
l!l
00
MC/DC0%0/1
$self->{"swbcc"} ||= "-b"
$self->{"swbcc"}
Truth table0%0/2
A
A= $self->{"swbcc"}
Aresult
11
00
46 0 $cmdline .= qq| $self->{to}|;
47  
48 0 ▶ $self->{v} > 1 and print "[$cmdline]\n";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"v"} > 1 and print "[$cmdline]\n" 0 0 0
49 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
50 0 local *MAILER;
51 0 ▶ if ( open MAILER, "| $cmdline " ) {
Branch: 1 branch
BranchTrueFalseTotal
if (open MAILER, "| $cmdline ") { } 0 0 0
52 0 print MAILER $self->{body};
53 close MAILER or
54 0 ▶ $self->{error} = "Error in pipe to '$mailer': $! (" . $?>>8 . ")";
Branch: 1 branch
BranchTrueFalseTotal
close MAILER or $self->{"error"} = "Error in pipe to '${mailer}': $! (" . $? >> "8)" 0 0 0
55 } else {
56 0 $self->{error} = "Cannot fork '$mailer': $!";
57 }
58 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
59  
60 0 return ! $self->{error};
61 }
62  
63 3 1;
64  
65 =head1 COPYRIGHT
66  
67 (c) 2002-2013, All rights reserved.
68  
69 * Abe Timmerman <abeltje@cpan.org>
70  
71 This library is free software; you can redistribute it and/or modify
72 it under the same terms as Perl itself.
73  
74 See:
75  
76 * <http://www.perl.com/perl/misc/Artistic.html>,
77 * <http://www.gnu.org/copyleft/gpl.html>
78  
79 This program is distributed in the hope that it will be useful,
80 but WITHOUT ANY WARRANTY; without even the implied warranty of
81 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
82  
83 =cut
« blib/lib/Test/Smoke/App/ConfigSmoke.pm ↑ Summary blib/lib/Test/Smoke/Smoker.pm »