Transport/Sendmail.pm

filter: Statementstmt 42.5% 17 / 40 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 71.4% 5 / 7 Podpod 50.0% 1 / 2 totaltotal 31.5% 23 / 73 SCAR 36.3
CC
9
Cov
29%
init
30.0
trySend
30.0
BEGIN
1.0
CRAP 37.6
« Transport/Exim.pm ↑ Summary Transport/Qmail.pm »
1 # Copyrights 2001-2020 by [Mark Overmeer].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 # This code is part of distribution Mail-Transport. Meta-POD processed with
6 # OODoc into POD and HTML manual-pages. See README.md
7 # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8  
9 package Mail::Transport::Sendmail;
10 1 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $VERSION = '3.005';
12  
13 1 ▶use base 'Mail::Transport::Send';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20  
21 sub init($)
22 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=5 SCAR=34.0
Pod undocumented
23  
24 0 $args->{via} = 'sendmail';
25  
26 0 ▶ $self->SUPER::init($args) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($args) or return 0 0 0
27  
28 $self->{MTS_program}
29 = $args->{proxy}
30 0 ▶ || $self->findBinary('sendmail')
Condition0%0/5
$args->{'proxy'} || $self->findBinary('sendmail') || (return)
l!l
00
$args->{"proxy"} or $self->findBinary("sendmail")
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'proxy'} || $self->findBinary('sendmail') || (return)
$args->{"proxy"} $self->findBinary("sendmail")
Truth table0%0/3
A or B
A= $args->{"proxy"}B= $self->findBinary("sendmail")
ABresult
1X1
011
000
31 || return;
32  
33 0 ▶ $self->{MTS_opts} = $args->{sendmail_options} || [];
Condition0%0/2
$args->{'sendmail_options'} || []
l!l
00
MC/DC0%0/1
$args->{'sendmail_options'} || []
$args->{'sendmail_options'}
Truth table0%0/2
A
A= $args->{'sendmail_options'}
Aresult
11
00
34 0 $self;
35 }
36  
37 #------------------------------------------
38  
39  
40 sub trySend($@)
41 0 ▶{ my ($self, $message, %args) = @_;
Subroutine trySend: not called CC=5 SCAR=34.0
Pod documented
42  
43 0 my $program = $self->{MTS_program};
44 0 ▶ if(open(MAILER, '|-')==0)
Branch: 1 branch
BranchTrueFalseTotal
if (open(MAILER, "|-") == 0) 0 0 0
45 0 ▶ { my $options = $args{sendmail_options} || [];
Condition0%0/2
$args{'sendmail_options'} || []
l!l
00
MC/DC0%0/1
$args{'sendmail_options'} || []
$args{'sendmail_options'}
Truth table0%0/2
A
A= $args{'sendmail_options'}
Aresult
11
00
46 0 my @to = map {$_->address} $self->destinations($message, $args{to});
47  
48 # {} to avoid warning about code after exec
49 0 { exec $program, '-i', @{$self->{MTS_opts}}, @$options, @to; }
50  
51 0 $self->log(NOTICE => "Errors when opening pipe to $program: $!");
52 0 exit 1;
53 }
54
55 0 $self->putContent($message, \*MAILER, undisclosed => 1);
56  
57 0 ▶ unless(close MAILER)
Branch: 1 branch
BranchTrueFalseTotal
unless (close MAILER) 0 0 0
58 0 { $self->log(NOTICE => "Errors when closing sendmail mailer $program: $!");
59 0 ▶ $? ||= $!;
Condition0%0/3
$? ||= $!
l!l&&r!l&&!r
000
MC/DC0%0/2
$? ||= $!
$? $!
Truth table0%0/3
A ||= B
A= $?B= $!
ABresult
1X1
011
000
60 0 return 0;
61 }
62  
63 0 1;
64 }
65  
66 #------------------------------------------
67  
68 1 1;
« Transport/Exim.pm ↑ Summary Transport/Qmail.pm »