SMTP.pm

filter: Statementstmt 36.3% 122 / 336 Branchbran 13.8% 26 / 188 Conditioncond 23.3% 18 / 77 MC/DCmcdc 4.3% 2 / 46 Subroutinesub 36.6% 22 / 60 Podpod 92.0% 23 / 25 totaltotal 29.1% 213 / 732 CC 120 SCAR 53.2
CC
120
Cov
28%
mail
870.0
auth
342.0
recipient
240.0
CRAP 205.1
« Domain.pm ↑ Summary FTP/A.pm »
1 # Net::SMTP.pm
2 #
3 # Copyright (C) 1995-2004 Graham Barr. All rights reserved.
4 # Copyright (C) 2013-2016, 2020 Steve Hay. All rights reserved.
5 # This module is free software; you can redistribute it and/or modify it under
6 # the same terms as Perl itself, i.e. under the terms of either the GNU General
7 # Public License or the Artistic License, as specified in the F<LICENCE> file.
8  
9 package Net::SMTP;
10  
11 6 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 6 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 6 ▶use Net::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 6 ▶use Net::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 6 ▶use Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 6 our $VERSION = "3.16";
23  
24 # Code for detecting if we can use SSL
25 6 ▶my $ssl_class = eval {
Condition50%1/2
eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } } && 'IO::Socket::SSL'
!ll
06
MC/DC0%0/1
eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } } && 'IO::Socket::SSL'
eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } }
Truth table50%1/2
A
A= eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } }
Aresult
00
11
26 6 require IO::Socket::SSL;
27 # first version with default CA on most platforms
28 6 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
29 6 IO::Socket::SSL->VERSION(2.007);
30 } && 'IO::Socket::SSL';
31  
32 6 ▶my $nossl_warn = !$ssl_class &&
Condition50%1/2
!$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'
!ll
60
MC/DC0%0/1
!$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'
!$ssl_class
Truth table50%1/2
not(A)
A= !$ssl_class
Aresult
00
11
33 'To use SSL please install IO::Socket::SSL with version>=2.007';
34  
35 # Code for detecting if we can use IPv6
36 6 my $family_key = 'Domain';
37 my $inet6_class = eval {
38 6 require IO::Socket::IP;
39 6 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
40 6 ▶ IO::Socket::IP->VERSION(0.25) || die;
Branch: 1 branch
BranchTrueFalseTotal
"IO::Socket::IP"->VERSION("0.25") or die 6 0 6
41 6 ▶ $family_key = 'Family';
Condition0%0/2
eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } } and "IO::Socket::INET6"
!ll
00
MC/DC0%0/1
eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } } and "IO::Socket::INET6"
eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } }
Truth table0%0/2
A
A= eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } }
Aresult
00
11
42 6 ▶} && 'IO::Socket::IP' || eval {
Condition40%2/5
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::IP'->VERSION(0.25) or die; $family_key = 'Family' } } && 'IO::Socket::IP' || eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
l!l&&r!l&&!r
600
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::IP"->VERSION("0.25") or die; $family_key = "Family" } } and "IO::Socket::IP"
!ll
06
MC/DC0%0/2
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::IP'->VERSION(0.25) or die; $family_key = 'Family' } } && 'IO::Socket::IP' || eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::IP"->VERSION("0.25") or die; $family_key = "Family" } } eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
Truth table33%1/3
A || B
A= eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::IP"->VERSION("0.25") or die; $family_key = "Family" } }B= eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
ABresult
1X1
011
000
43 0 require IO::Socket::INET6;
44 6 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
45 0 IO::Socket::INET6->VERSION(2.62);
46 } && 'IO::Socket::INET6';
47  
48 3 ▶sub can_ssl { $ssl_class };
Subroutine can_ssl: called CC=1 SCAR=0.0
Pod documented
49 1 ▶sub can_inet6 { $inet6_class };
Subroutine can_inet6: called CC=1 SCAR=0.0
Pod documented
50  
51 6 ▶our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET');
Condition50%1/2
$inet6_class || 'IO::Socket::INET'
l!l
60
MC/DC0%0/1
$inet6_class || 'IO::Socket::INET'
$inet6_class
Truth table50%1/2
A
A= $inet6_class
Aresult
11
00
52  
53 3 ▶sub new {
Subroutine new: called CC=22 SCAR=37.3
Pod documented
54 3 my $self = shift;
55 3 ▶ my $type = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
030
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
56 3 my ($host, %arg);
57 3 ▶ if (@_ % 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ % 2) { } 3 0 3
58 3 $host = shift;
59 3 %arg = @_;
60 }
61 else {
62 0 %arg = @_;
63 0 $host = delete $arg{Host};
64 }
65  
66 3 ▶ if ($arg{SSL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg{"SSL"}) 2 1 3
67 # SSL from start
68 2 ▶ die $nossl_warn if !$ssl_class;
Branch: 1 branch
BranchTrueFalseTotal
unless $ssl_class 0 2 2
69 2 ▶ $arg{Port} ||= 465;
Condition50%1/2
$arg{"Port"} ||= 465
l!l
02
MC/DC0%0/1
$arg{"Port"} ||= 465
$arg{"Port"}
Truth table50%1/2
A
A= $arg{"Port"}
Aresult
11
00
70 }
71  
72 3 ▶ my $hosts = defined $host ? $host : $NetConfig{smtp_hosts};
Branch: 1 branch
BranchTrueFalseTotal
defined $host ? : 3 0 3
73 3 my $obj;
74  
75 3 ▶ $arg{Timeout} = 120 if ! defined $arg{Timeout};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg{"Timeout"} 3 0 3
76  
77 3 ▶ foreach my $h (@{ref($hosts) ? $hosts : [$hosts]}) {
Branch: 1 branch
BranchTrueFalseTotal
ref $hosts ? : 0 3 3
78 $obj = $type->SUPER::new(
79 PeerAddr => ($host = $h),
80 PeerPort => $arg{Port} || 'smtp(25)',
81 LocalAddr => $arg{LocalAddr},
82 LocalPort => $arg{LocalPort},
83 $family_key => $arg{Domain} || $arg{Family},
84 Proto => 'tcp',
85 Timeout => $arg{Timeout}
86 )
87 3 ▶ and last;
Branch: 1 branch
BranchTrueFalseTotal
$obj = $type->SUPER::new("PeerAddr", $host = $h, "PeerPort", $arg{"Port"} || "smtp(25)", "LocalAddr", $arg{"LocalAddr"}, "LocalPort", $arg{"LocalPort"}, $family_key, $arg{"Domain"} || $arg{"Family"}, "Proto", "tcp", "Timeout", $arg{"Timeout"}) and last 3 0 3
Condition60%3/5
$arg{'Port'} || 'smtp(25)'
l!l
21
$arg{'Domain'} || $arg{'Family'}
l!l&&r!l&&!r
003
MC/DC100%1/1
$arg{'Port'} || 'smtp(25)'
$arg{'Port'}
MC/DC0%0/2
$arg{'Domain'} || $arg{'Family'}
$arg{'Domain'} $arg{'Family'}
Truth table100%2/2
A
A= $arg{'Port'}
Aresult
11
00
Truth table33%1/3
A || B
A= $arg{'Domain'}B= $arg{'Family'}
ABresult
1X1
011
000
88 }
89  
90 return
91 3 ▶ unless defined $obj;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $obj 0 3 3
92  
93 3 ${*$obj}{'net_smtp_arg'} = \%arg;
94 3 ${*$obj}{'net_smtp_host'} = $host;
95  
96 3 ▶ if ($arg{SSL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg{"SSL"}) 2 1 3
97 2 ▶ Net::SMTP::_SSL->start_SSL($obj,%arg)
Branch: 1 branch
BranchTrueFalseTotal
"Net::SMTP::_SSL"->start_SSL($obj, %arg) or return 2 0 2
98 or return;
99 }
100  
101 3 $obj->autoflush(1);
102  
103 3 ▶ $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef);
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'Debug'} ? : 3 0 3
104  
105 3 ▶ unless ($obj->response() == CMD_OK) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->response == 2) 0 3 3
106 0 my $err = ref($obj) . ": " . $obj->code . " " . $obj->message;
107 0 $obj->close();
108 0 $@ = $err;
109 0 return;
110 }
111  
112 3 ${*$obj}{'net_smtp_exact_addr'} = $arg{ExactAddresses};
113  
114 3 (${*$obj}{'net_smtp_banner'}) = $obj->message;
115 3 (${*$obj}{'net_smtp_domain'}) = $obj->message =~ /\A\s*(\S+)/;
116  
117 3 ▶ if (!exists $arg{SendHello} || $arg{SendHello}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $arg{"SendHello"} or $arg{"SendHello"}) 3 0 3
Condition33%1/3
not exists $arg{"SendHello"} or $arg{"SendHello"}
l!l&&r!l&&!r
300
MC/DC0%0/2
not exists $arg{"SendHello"} or $arg{"SendHello"}
not exists $arg{"SendHello"} $arg{"SendHello"}
Truth table33%1/3
not(A) or B
A= not exists $arg{"SendHello"}B= $arg{"SendHello"}
ABresult
1X1
011
000
118 3 ▶ unless ($obj->hello($arg{Hello} || "")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->hello($arg{"Hello"} || "")) 0 3 3
Condition50%1/2
$arg{'Hello'} || ''
l!l
03
MC/DC0%0/1
$arg{'Hello'} || ''
$arg{'Hello'}
Truth table50%1/2
A
A= $arg{'Hello'}
Aresult
11
00
119 0 my $err = ref($obj) . ": " . $obj->code . " " . $obj->message;
120 0 $obj->close();
121 0 $@ = $err;
122 0 return;
123 }
124 }
125  
126 3 $obj;
127 }
128  
129  
130 0 ▶sub host {
Subroutine host: not called CC=1 SCAR=6.9
Pod documented
131 0 my $me = shift;
132 0 ${*$me}{'net_smtp_host'};
133 }
134  
135 ##
136 ## User interface methods
137 ##
138  
139  
140 0 ▶sub banner {
Subroutine banner: not called CC=2 SCAR=17.9
Pod documented
141 0 my $me = shift;
142  
143 0 ▶ return ${*$me}{'net_smtp_banner'} || undef;
Condition0%0/2
do { *$me }->{'net_smtp_banner'} || undef
l!l
00
MC/DC0%0/1
do { *$me }->{'net_smtp_banner'} || undef
do { *$me }->{'net_smtp_banner'}
Truth table0%0/2
A
A= do { *$me }->{'net_smtp_banner'}
Aresult
11
00
144 }
145  
146  
147 0 ▶sub domain {
Subroutine domain: not called CC=2 SCAR=17.9
Pod documented
148 0 my $me = shift;
149  
150 0 ▶ return ${*$me}{'net_smtp_domain'} || undef;
Condition0%0/2
do { *$me }->{'net_smtp_domain'} || undef
l!l
00
MC/DC0%0/1
do { *$me }->{'net_smtp_domain'} || undef
do { *$me }->{'net_smtp_domain'}
Truth table0%0/2
A
A= do { *$me }->{'net_smtp_domain'}
Aresult
11
00
151 }
152  
153  
154 0 ▶sub etrn {
Subroutine etrn: not called CC=2 SCAR=17.9
Pod documented
155 0 my $self = shift;
156 0 ▶ defined($self->supports('ETRN', 500, ["Command unknown: 'ETRN'"]))
Branch: 1 branch
BranchTrueFalseTotal
defined $self->supports("ETRN", 500, ["Command unknown: 'ETRN'"]) and $self->_ETRN(@_) 0 0 0
157 && $self->_ETRN(@_);
158 }
159  
160  
161 0 ▶sub auth {
Subroutine auth: not called CC=18 SCAR=58.3
Pod documented
162 0 my ($self, $username, $password) = @_;
163  
164 0 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { require MIME::Base64; require Authen::SASL } } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), (return 0) 0 0 0
165 0 require MIME::Base64;
166 0 require Authen::SASL;
167 } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0;
168  
169 0 my $mechanisms = $self->supports('AUTH', 500, ["Command unknown: 'AUTH'"]);
170 0 ▶ return unless defined $mechanisms;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mechanisms 0 0 0
171  
172 0 my $sasl;
173  
174 0 ▶ if (ref($username) and UNIVERSAL::isa($username, 'Authen::SASL')) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $username and UNIVERSAL::isa($username, 'Authen::SASL')) { } 0 0 0
Condition0%0/3
ref $username and UNIVERSAL::isa($username, "Authen::SASL")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $username and UNIVERSAL::isa($username, "Authen::SASL")
ref $username UNIVERSAL::isa($username, "Authen::SASL")
Truth table0%0/3
A and B
A= ref $usernameB= UNIVERSAL::isa($username, "Authen::SASL")
ABresult
0X0
100
111
175 0 $sasl = $username;
176 0 my $requested_mechanisms = $sasl->mechanism();
177 0 ▶ if (! defined($requested_mechanisms) || $requested_mechanisms eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $requested_mechanisms or $requested_mechanisms eq "") 0 0 0
Condition0%0/3
not defined $requested_mechanisms or $requested_mechanisms eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $requested_mechanisms or $requested_mechanisms eq ""
not defined $requested_mechanisms $requested_mechanisms eq ""
Truth table0%0/3
not(A) or B
A= not defined $requested_mechanismsB= $requested_mechanisms eq ""
ABresult
1X1
011
000
178 0 $sasl->mechanism($mechanisms);
179 }
180 }
181 else {
182 0 ▶ die "auth(username, password)" if not length $username;
Branch: 1 branch
BranchTrueFalseTotal
unless length $username 0 0 0
183 0 $sasl = Authen::SASL->new(
184 mechanism => $mechanisms,
185 callback => {
186 user => $username,
187 pass => $password,
188 authname => $username,
189 },
190 debug => $self->debug
191 );
192 }
193  
194 0 my $client;
195 my $str;
196 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
defined $str or do { do { if ($client) { my $failed_mechanism = $client->mechanism; return unless defined $failed_mechanism; $self->debug_text("Auth mechanism failed: $failed_mechanism") if $self->debug; $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; return unless $mechanisms =~ /\S/; $sasl->mechanism($mechanisms); } ; $client = $sasl->client_new("smtp", do { *$self }->{"net_smtp_host"}, 0); $str = $client->client_start } } 0 0 0
197 0 ▶ if ($client) {
Branch: 1 branch
BranchTrueFalseTotal
if ($client) 0 0 0
198 # $client mechanism failed, so we need to exclude this mechanism from list
199 0 my $failed_mechanism = $client->mechanism;
200 0 ▶ return unless defined $failed_mechanism;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $failed_mechanism 0 0 0
201 0 ▶ $self->debug_text("Auth mechanism failed: $failed_mechanism")
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
202 if $self->debug;
203 0 $mechanisms =~ s/\b\Q$failed_mechanism\E\b//;
204 0 ▶ return unless $mechanisms =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless $mechanisms =~ /\S/ 0 0 0
205 0 $sasl->mechanism($mechanisms);
206 }
207
208 # We should probably allow the user to pass the host, but I don't
209 # currently know and SASL mechanisms that are used by smtp that need it
210  
211 0 $client = $sasl->client_new('smtp', ${*$self}{'net_smtp_host'}, 0);
212 0 $str = $client->client_start;
213 } while (!defined $str);
214  
215 # We don't support sasl mechanisms that encrypt the socket traffic.
216 # todo that we would really need to change the ISA hierarchy
217 # so we don't inherit from IO::Socket, but instead hold it in an attribute
218  
219 0 my @cmd = ("AUTH", $client->mechanism);
220 0 my $code;
221  
222 0 ▶ push @cmd, MIME::Base64::encode_base64($str, '')
Branch: 1 branch
BranchTrueFalseTotal
if defined $str and length $str 0 0 0
Condition0%0/3
defined $str and length $str
!ll&&!rl&&r
000
MC/DC0%0/2
defined $str and length $str
defined $str length $str
Truth table0%0/3
A and B
A= defined $strB= length $str
ABresult
0X0
100
111
223 if defined $str and length $str;
224  
225 0 ▶ while (($code = $self->command(@cmd)->response()) == CMD_MORE) {
Branch: 1 branch
BranchTrueFalseTotal
if (($code = $self->command(@cmd)->response) == 3) 0 0 0
226 0 my $str2 = MIME::Base64::decode_base64(($self->message)[0]);
227 0 ▶ $self->debug_print(0, "(decoded) " . $str2 . "\n") if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
228  
229 0 $str = $client->client_step($str2);
230 0 @cmd = (
231 MIME::Base64::encode_base64($str, '')
232 );
233  
234 0 ▶ $self->debug_print(1, "(decoded) " . $str . "\n") if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
235 }
236  
237 0 $code == CMD_OK;
238 }
239  
240  
241 4 ▶sub hello {
Subroutine hello: called CC=9 SCAR=24.4
Pod documented
242 4 my $me = shift;
243 4 ▶ my $domain = shift || "localhost.localdomain";
Condition100%2/2
shift() || 'localhost.localdomain'
l!l
13
MC/DC100%1/1
shift() || 'localhost.localdomain'
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
244 4 my $ok = $me->_EHLO($domain);
245 4 my @msg = $me->message;
246  
247 4 ▶ if ($ok) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ok) { } 4 0 4
elsif ($me->status == 5) { } 0 0 0
248 4 my $h = ${*$me}{'net_smtp_esmtp'} = {};
249 4 foreach my $ln (@msg) {
250 9 ▶ $h->{uc $1} = $2
Branch: 1 branch
BranchTrueFalseTotal
if $ln =~ /([-\w]+)\b[= \t]*([^\n]*)/ 9 0 9
251 if $ln =~ /([-\w]+)\b[= \t]*([^\n]*)/;
252 }
253 }
254 elsif ($me->status == CMD_ERROR) {
255 0 ▶ @msg = $me->message
Branch: 1 branch
BranchTrueFalseTotal
if $ok = $me->_HELO($domain) 0 0 0
256 if $ok = $me->_HELO($domain);
257 }
258  
259 4 ▶ return unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 4 4
260 4 ${*$me}{net_smtp_hello_domain} = $domain;
261  
262 4 $msg[0] =~ /\A\s*(\S+)/;
263 4 ▶ return ($1 || " ");
Condition50%1/2
$1 || ' '
l!l
40
MC/DC0%0/1
$1 || ' '
$1
Truth table50%1/2
A
A= $1
Aresult
11
00
264 }
265  
266 1 ▶sub starttls {
Subroutine starttls: called CC=4 SCAR=14.2
Pod documented
267 1 my $self = shift;
268 1 ▶ $ssl_class or die $nossl_warn;
Branch: 1 branch
BranchTrueFalseTotal
$ssl_class or die $nossl_warn 1 0 1
269 1 ▶ $self->_STARTTLS or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->_STARTTLS or return 1 0 1
270 Net::SMTP::_SSL->start_SSL($self,
271 1 ▶ %{ ${*$self}{'net_smtp_arg'} }, # (ssl) args given in new
Branch: 1 branch
BranchTrueFalseTotal
"Net::SMTP::_SSL"->start_SSL($self, %{${*$self;}{"net_smtp_arg"};}, @_) or return 1 0 1
272 @_ # more (ssl) args
273 ) or return;
274  
275 # another hello after starttls to read new ESMTP capabilities
276 1 return $self->hello(${*$self}{net_smtp_hello_domain});
277 }
278  
279  
280 0 ▶sub supports {
Subroutine supports: not called CC=3 SCAR=24.8
Pod undocumented
281 0 my $self = shift;
282 0 my $cmd = uc shift;
283 0 return ${*$self}{'net_smtp_esmtp'}->{$cmd}
284 0 ▶ if exists ${*$self}{'net_smtp_esmtp'}->{$cmd};
Branch: 1 branch
BranchTrueFalseTotal
if exists do { *$self }->{"net_smtp_esmtp"}{$cmd} 0 0 0
285 0 ▶ $self->set_status(@_)
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
286 if @_;
287 0 return;
288 }
289  
290  
291 0 ▶sub _addr {
Subroutine _addr: not called CC=5 SCAR=34.0
292 0 my $self = shift;
293 0 my $addr = shift;
294 0 ▶ $addr = "" unless defined $addr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $addr 0 0 0
295  
296 0 ▶ if (${*$self}{'net_smtp_exact_addr'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { *$self }->{'net_smtp_exact_addr'}) { } 0 0 0
297 0 ▶ return $1 if $addr =~ /^\s*(<.*>)\s*$/s;
Branch: 1 branch
BranchTrueFalseTotal
if $addr =~ /^\s*(<.*>)\s*$/s 0 0 0
298 }
299 else {
300 0 ▶ return $1 if $addr =~ /(<[^>]*>)/;
Branch: 1 branch
BranchTrueFalseTotal
if $addr =~ /(<[^>]*>)/ 0 0 0
301 0 $addr =~ s/^\s+|\s+$//sg;
302 }
303  
304 0 "<$addr>";
305 }
306  
307  
308 0 ▶sub mail {
Subroutine mail: not called CC=29 SCAR=67.7
Pod documented
309 0 my $me = shift;
310 0 my $addr = _addr($me, shift);
311 0 my $opts = "";
312  
313 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
314 0 my %opt = @_;
315 0 my ($k, $v);
316  
317 0 ▶ if (exists ${*$me}{'net_smtp_esmtp'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { *$me }->{'net_smtp_esmtp'}) { } 0 0 0
318 0 my $esmtp = ${*$me}{'net_smtp_esmtp'};
319  
320 0 ▶ if (defined($v = delete $opt{Size})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"Size"})) 0 0 0
321 0 ▶ if (exists $esmtp->{SIZE}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'SIZE'}) { } 0 0 0
322 0 $opts .= sprintf " SIZE=%d", $v + 0;
323 }
324 else {
325 0 carp 'Net::SMTP::mail: SIZE option not supported by host';
326 }
327 }
328  
329 0 ▶ if (defined($v = delete $opt{Return})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"Return"})) 0 0 0
330 0 ▶ if (exists $esmtp->{DSN}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'DSN'}) { } 0 0 0
331 0 ▶ $opts .= " RET=" . ((uc($v) eq "FULL") ? "FULL" : "HDRS");
Branch: 1 branch
BranchTrueFalseTotal
uc $v eq 'FULL' ? : 0 0 0
332 }
333 else {
334 0 carp 'Net::SMTP::mail: DSN option not supported by host';
335 }
336 }
337  
338 0 ▶ if (defined($v = delete $opt{Bits})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"Bits"})) 0 0 0
339 0 ▶ if ($v eq "8") {
Branch: 3 branches
BranchTrueFalseTotal
if ($v eq '8') { } 0 0 0
elsif ($v eq 'binary') { } 0 0 0
elsif (exists $esmtp->{'8BITMIME'} or exists $esmtp->{'BINARYMIME'}) { } 0 0 0
340 0 ▶ if (exists $esmtp->{'8BITMIME'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'8BITMIME'}) { } 0 0 0
341 0 $opts .= " BODY=8BITMIME";
342 }
343 else {
344 0 carp 'Net::SMTP::mail: 8BITMIME option not supported by host';
345 }
346 }
347 elsif ($v eq "binary") {
348 0 ▶ if (exists $esmtp->{'BINARYMIME'} && exists $esmtp->{'CHUNKING'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'BINARYMIME'} and exists $esmtp->{'CHUNKING'}) { } 0 0 0
Condition0%0/3
exists $esmtp->{"BINARYMIME"} and exists $esmtp->{"CHUNKING"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $esmtp->{"BINARYMIME"} and exists $esmtp->{"CHUNKING"}
exists $esmtp->{"BINARYMIME"} exists $esmtp->{"CHUNKING"}
Truth table0%0/3
A and B
A= exists $esmtp->{"BINARYMIME"}B= exists $esmtp->{"CHUNKING"}
ABresult
0X0
100
111
349 0 $opts .= " BODY=BINARYMIME";
350 0 ${*$me}{'net_smtp_chunking'} = 1;
351 }
352 else {
353 0 carp 'Net::SMTP::mail: BINARYMIME option not supported by host';
354 }
355 }
356 ▶ elsif (exists $esmtp->{'8BITMIME'} or exists $esmtp->{'BINARYMIME'}) {
Condition0%0/3
exists $esmtp->{"8BITMIME"} or exists $esmtp->{"BINARYMIME"}
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $esmtp->{"8BITMIME"} or exists $esmtp->{"BINARYMIME"}
exists $esmtp->{"8BITMIME"} exists $esmtp->{"BINARYMIME"}
Truth table0%0/3
A or B
A= exists $esmtp->{"8BITMIME"}B= exists $esmtp->{"BINARYMIME"}
ABresult
1X1
011
000
357 0 $opts .= " BODY=7BIT";
358 }
359 else {
360 0 carp 'Net::SMTP::mail: 8BITMIME and BINARYMIME options not supported by host';
361 }
362 }
363  
364 0 ▶ if (defined($v = delete $opt{Transaction})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"Transaction"})) 0 0 0
365 0 ▶ if (exists $esmtp->{CHECKPOINT}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'CHECKPOINT'}) { } 0 0 0
366 0 $opts .= " TRANSID=" . _addr($me, $v);
367 }
368 else {
369 0 carp 'Net::SMTP::mail: CHECKPOINT option not supported by host';
370 }
371 }
372  
373 0 ▶ if (defined($v = delete $opt{Envelope})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"Envelope"})) 0 0 0
374 0 ▶ if (exists $esmtp->{DSN}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'DSN'}) { } 0 0 0
375 0 $v =~ s/([^\041-\176]|=|\+)/sprintf "+%02X", ord($1)/sge;
376 0 $opts .= " ENVID=$v";
377 }
378 else {
379 0 carp 'Net::SMTP::mail: DSN option not supported by host';
380 }
381 }
382  
383 0 ▶ if (defined($v = delete $opt{ENVID})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"ENVID"})) 0 0 0
384  
385 # expected to be in a format as required by RFC 3461, xtext-encoded
386 0 ▶ if (exists $esmtp->{DSN}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'DSN'}) { } 0 0 0
387 0 $opts .= " ENVID=$v";
388 }
389 else {
390 0 carp 'Net::SMTP::mail: DSN option not supported by host';
391 }
392 }
393  
394 0 ▶ if (defined($v = delete $opt{AUTH})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"AUTH"})) 0 0 0
395  
396 # expected to be in a format as required by RFC 2554,
397 # rfc2821-quoted and xtext-encoded, or <>
398 0 ▶ if (exists $esmtp->{AUTH}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'AUTH'}) { } 0 0 0
399 0 ▶ $v = '<>' if !defined($v) || $v eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $v or $v eq "" 0 0 0
Condition0%0/3
not defined $v or $v eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $v or $v eq ""
not defined $v $v eq ""
Truth table0%0/3
not(A) or B
A= not defined $vB= $v eq ""
ABresult
1X1
011
000
400 0 $opts .= " AUTH=$v";
401 }
402 else {
403 0 carp 'Net::SMTP::mail: AUTH option not supported by host';
404 }
405 }
406  
407 0 ▶ if (defined($v = delete $opt{XVERP})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"XVERP"})) 0 0 0
408 0 ▶ if (exists $esmtp->{'XVERP'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'XVERP'}) { } 0 0 0
409 0 $opts .= " XVERP";
410 }
411 else {
412 0 carp 'Net::SMTP::mail: XVERP option not supported by host';
413 }
414 }
415  
416 0 ▶ carp 'Net::SMTP::recipient: unknown option(s) ' . join(" ", keys %opt) . ' - ignored'
Branch: 1 branch
BranchTrueFalseTotal
if scalar keys %opt 0 0 0
417 if scalar keys %opt;
418 }
419 else {
420 0 carp 'Net::SMTP::mail: ESMTP not supported by host - options discarded :-(';
421 }
422 }
423  
424 0 $me->_MAIL("FROM:" . $addr . $opts);
425 }
426  
427  
428 0 ▶sub send { my $me = shift; $me->_SEND("FROM:" . _addr($me, $_[0])) }
Subroutine send: not called CC=1 SCAR=6.9
Pod documented
429 0 ▶sub send_or_mail { my $me = shift; $me->_SOML("FROM:" . _addr($me, $_[0])) }
Subroutine send_or_mail: not called CC=1 SCAR=6.9
Pod documented
430 0 ▶sub send_and_mail { my $me = shift; $me->_SAML("FROM:" . _addr($me, $_[0])) }
Subroutine send_and_mail: not called CC=1 SCAR=6.9
Pod documented
431  
432  
433 0 ▶sub reset {
Subroutine reset: not called CC=2 SCAR=17.9
Pod documented
434 0 my $me = shift;
435  
436 $me->dataend()
437 0 ▶ if (exists ${*$me}{'net_smtp_lastch'});
Branch: 1 branch
BranchTrueFalseTotal
if exists do { *$me }->{"net_smtp_lastch"} 0 0 0
438  
439 0 $me->_RSET();
440 }
441  
442  
443 0 ▶sub recipient {
Subroutine recipient: not called CC=15 SCAR=54.8
Pod documented
444 0 my $smtp = shift;
445 0 my $opts = "";
446 0 my $skip_bad = 0;
447  
448 0 ▶ if (@_ && ref($_[-1])) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and ref $_[-1]) 0 0 0
Condition0%0/3
@_ and ref $_[-1]
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and ref $_[-1]
@_ ref $_[-1]
Truth table0%0/3
A and B
A= @_B= ref $_[-1]
ABresult
0X0
100
111
449 0 my %opt = %{pop(@_)};
450 0 my $v;
451  
452 0 $skip_bad = delete $opt{'SkipBad'};
453  
454 0 ▶ if (exists ${*$smtp}{'net_smtp_esmtp'}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists do { *$smtp }->{'net_smtp_esmtp'}) { } 0 0 0
elsif (%opt) { } 0 0 0
455 0 my $esmtp = ${*$smtp}{'net_smtp_esmtp'};
456  
457 0 ▶ if (defined($v = delete $opt{Notify})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"Notify"})) 0 0 0
458 0 ▶ if (exists $esmtp->{DSN}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'DSN'}) { } 0 0 0
459 0 $opts .= " NOTIFY=" . join(",", map { uc $_ } @$v);
460 }
461 else {
462 0 carp 'Net::SMTP::recipient: DSN option not supported by host';
463 }
464 }
465  
466 0 ▶ if (defined($v = delete $opt{ORcpt})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($v = delete $opt{"ORcpt"})) 0 0 0
467 0 ▶ if (exists $esmtp->{DSN}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $esmtp->{'DSN'}) { } 0 0 0
468 0 $opts .= " ORCPT=" . $v;
469 }
470 else {
471 0 carp 'Net::SMTP::recipient: DSN option not supported by host';
472 }
473 }
474  
475 0 ▶ carp 'Net::SMTP::recipient: unknown option(s) ' . join(" ", keys %opt) . ' - ignored'
Branch: 1 branch
BranchTrueFalseTotal
if scalar keys %opt 0 0 0
476 if scalar keys %opt;
477 }
478 elsif (%opt) {
479 0 carp 'Net::SMTP::recipient: ESMTP not supported by host - options discarded :-(';
480 }
481 }
482  
483 0 my @ok;
484 0 foreach my $addr (@_) {
485 0 ▶ if ($smtp->_RCPT("TO:" . _addr($smtp, $addr) . $opts)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($smtp->_RCPT('TO:' . _addr($smtp, $addr) . $opts)) { } 0 0 0
elsif (not $skip_bad) { } 0 0 0
486 0 ▶ push(@ok, $addr) if $skip_bad;
Branch: 1 branch
BranchTrueFalseTotal
if $skip_bad 0 0 0
487 }
488 elsif (!$skip_bad) {
489 0 return 0;
490 }
491 }
492  
493 0 ▶ return $skip_bad ? @ok : 1;
Branch: 1 branch
BranchTrueFalseTotal
$skip_bad ? : 0 0 0
494 }
495  
496 6 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
497 6 *to = \&recipient;
498 6 *cc = \&recipient;
499 6 *bcc = \&recipient;
500 }
501  
502  
503 0 ▶sub data {
Subroutine data: not called CC=5 SCAR=34.0
Pod documented
504 0 my $me = shift;
505  
506 0 ▶ if (exists ${*$me}{'net_smtp_chunking'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { *$me }->{'net_smtp_chunking'}) { } 0 0 0
507 0 carp 'Net::SMTP::data: CHUNKING extension in use, must call bdat instead';
508 }
509 else {
510 0 ▶ my $ok = $me->_DATA() && $me->datasend(@_);
Condition0%0/3
$me->_DATA && $me->datasend(@_)
!ll&&!rl&&r
000
MC/DC0%0/2
$me->_DATA && $me->datasend(@_)
$me->_DATA $me->datasend(@_)
Truth table0%0/3
A && B
A= $me->_DATAB= $me->datasend(@_)
ABresult
0X0
100
111
511  
512 0 ▶ $ok && @_
Branch: 1 branch
BranchTrueFalseTotal
$ok && @_ ? : 0 0 0
Condition0%0/3
$ok and @_
!ll&&!rl&&r
000
MC/DC0%0/2
$ok and @_
$ok @_
Truth table0%0/3
A and B
A= $okB= @_
ABresult
0X0
100
111
513 ? $me->dataend
514 : $ok;
515 }
516 }
517  
518  
519 0 ▶sub bdat {
Subroutine bdat: not called CC=4 SCAR=30.0
Pod documented
520 0 my $me = shift;
521  
522 0 ▶ if (exists ${*$me}{'net_smtp_chunking'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { *$me }->{'net_smtp_chunking'}) { } 0 0 0
523 0 my $data = shift;
524  
525 0 ▶ $me->_BDAT(length $data)
Branch: 1 branch
BranchTrueFalseTotal
$me->_BDAT(length $data) and $me->rawdatasend($data) and $me->response == 2 0 0 0
Condition0%0/3
$me->_BDAT(length $data) and $me->rawdatasend($data)
!ll&&!rl&&r
000
MC/DC0%0/2
$me->_BDAT(length $data) and $me->rawdatasend($data)
$me->_BDAT(length $data) $me->rawdatasend($data)
Truth table0%0/3
A and B
A= $me->_BDAT(length $data)B= $me->rawdatasend($data)
ABresult
0X0
100
111
526 && $me->rawdatasend($data)
527 && $me->response() == CMD_OK;
528 }
529 else {
530 0 carp 'Net::SMTP::bdat: CHUNKING extension is not in use, call data instead';
531 }
532 }
533  
534  
535 0 ▶sub bdatlast {
Subroutine bdatlast: not called CC=4 SCAR=30.0
Pod documented
536 0 my $me = shift;
537  
538 0 ▶ if (exists ${*$me}{'net_smtp_chunking'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { *$me }->{'net_smtp_chunking'}) { } 0 0 0
539 0 my $data = shift;
540  
541 0 ▶ $me->_BDAT(length $data, "LAST")
Branch: 1 branch
BranchTrueFalseTotal
$me->_BDAT(length $data, "LAST") and $me->rawdatasend($data) and $me->response == 2 0 0 0
Condition0%0/3
$me->_BDAT(length $data, "LAST") and $me->rawdatasend($data)
!ll&&!rl&&r
000
MC/DC0%0/2
$me->_BDAT(length $data, "LAST") and $me->rawdatasend($data)
$me->_BDAT(length $data, "LAST") $me->rawdatasend($data)
Truth table0%0/3
A and B
A= $me->_BDAT(length $data, "LAST")B= $me->rawdatasend($data)
ABresult
0X0
100
111
542 && $me->rawdatasend($data)
543 && $me->response() == CMD_OK;
544 }
545 else {
546 0 carp 'Net::SMTP::bdat: CHUNKING extension is not in use, call data instead';
547 }
548 }
549  
550  
551 0 ▶sub datafh {
Subroutine datafh: not called CC=2 SCAR=17.9
Pod undocumented
552 0 my $me = shift;
553 0 ▶ return unless $me->_DATA();
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_DATA 0 0 0
554 0 return $me->tied_fh;
555 }
556  
557  
558 0 ▶sub expand {
Subroutine expand: not called CC=2 SCAR=17.9
Pod documented
559 0 my $me = shift;
560  
561 0 ▶ $me->_EXPN(@_)
Branch: 1 branch
BranchTrueFalseTotal
$me->_EXPN(@_) ? : 0 0 0
562 ? ($me->message)
563 : ();
564 }
565  
566  
567 0 ▶sub verify { shift->_VRFY(@_) }
Subroutine verify: not called CC=1 SCAR=6.9
Pod documented
568  
569  
570 0 ▶sub help {
Subroutine help: not called CC=2 SCAR=17.9
Pod documented
571 0 my $me = shift;
572  
573 0 ▶ $me->_HELP(@_)
Branch: 1 branch
BranchTrueFalseTotal
$me->_HELP(@_) ? : 0 0 0
574 ? scalar $me->message
575 : undef;
576 }
577  
578  
579 3 ▶sub quit {
Subroutine quit: called CC=1 SCAR=0.0
Pod documented
580 3 my $me = shift;
581  
582 3 $me->_QUIT;
583 3 $me->close;
584 }
585  
586  
587 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=1 SCAR=0.0
588  
589 # ignore
590 }
591  
592 ##
593 ## RFC821 commands
594 ##
595  
596  
597 4 ▶sub _EHLO { shift->command("EHLO", @_)->response() == CMD_OK }
Subroutine _EHLO: called CC=1 SCAR=0.0
598 0 ▶sub _HELO { shift->command("HELO", @_)->response() == CMD_OK }
Subroutine _HELO: not called CC=1 SCAR=6.9
599 0 ▶sub _MAIL { shift->command("MAIL", @_)->response() == CMD_OK }
Subroutine _MAIL: not called CC=1 SCAR=6.9
600 0 ▶sub _RCPT { shift->command("RCPT", @_)->response() == CMD_OK }
Subroutine _RCPT: not called CC=1 SCAR=6.9
601 0 ▶sub _SEND { shift->command("SEND", @_)->response() == CMD_OK }
Subroutine _SEND: not called CC=1 SCAR=6.9
602 0 ▶sub _SAML { shift->command("SAML", @_)->response() == CMD_OK }
Subroutine _SAML: not called CC=1 SCAR=6.9
603 0 ▶sub _SOML { shift->command("SOML", @_)->response() == CMD_OK }
Subroutine _SOML: not called CC=1 SCAR=6.9
604 0 ▶sub _VRFY { shift->command("VRFY", @_)->response() == CMD_OK }
Subroutine _VRFY: not called CC=1 SCAR=6.9
605 0 ▶sub _EXPN { shift->command("EXPN", @_)->response() == CMD_OK }
Subroutine _EXPN: not called CC=1 SCAR=6.9
606 0 ▶sub _HELP { shift->command("HELP", @_)->response() == CMD_OK }
Subroutine _HELP: not called CC=1 SCAR=6.9
607 0 ▶sub _RSET { shift->command("RSET")->response() == CMD_OK }
Subroutine _RSET: not called CC=1 SCAR=6.9
608 0 ▶sub _NOOP { shift->command("NOOP")->response() == CMD_OK }
Subroutine _NOOP: not called CC=1 SCAR=6.9
609 3 ▶sub _QUIT { shift->command("QUIT")->response() == CMD_OK }
Subroutine _QUIT: called CC=1 SCAR=0.0
610 0 ▶sub _DATA { shift->command("DATA")->response() == CMD_MORE }
Subroutine _DATA: not called CC=1 SCAR=6.9
611 0 ▶sub _BDAT { shift->command("BDAT", @_) }
Subroutine _BDAT: not called CC=1 SCAR=6.9
612 0 ▶sub _TURN { shift->unsupported(@_); }
Subroutine _TURN: not called CC=1 SCAR=6.9
613 0 ▶sub _ETRN { shift->command("ETRN", @_)->response() == CMD_OK }
Subroutine _ETRN: not called CC=1 SCAR=6.9
614 0 ▶sub _AUTH { shift->command("AUTH", @_)->response() == CMD_OK }
Subroutine _AUTH: not called CC=1 SCAR=6.9
615 1 ▶sub _STARTTLS { shift->command("STARTTLS")->response() == CMD_OK }
Subroutine _STARTTLS: called CC=1 SCAR=0.0
616  
617  
618 {
619 package Net::SMTP::_SSL;
620 6 ▶ our @ISA = ( $ssl_class ? ($ssl_class):(), 'Net::SMTP' );
Branch: 1 branch
BranchTrueFalseTotal
$ssl_class ? : 6 0 6
621 0 ▶ sub starttls { die "SMTP connection is already in SSL mode" }
Subroutine starttls: not called CC=1 SCAR=6.9
622 3 ▶ sub start_SSL {
Subroutine start_SSL: called CC=6 SCAR=19.9
623 3 my ($class,$smtp,%arg) = @_;
624 3 delete @arg{ grep { !m{^SSL_} } keys %arg };
625 3 ▶ ( $arg{SSL_verifycn_name} ||= $smtp->host )
Condition33%1/3
$arg{"SSL_verifycn_name"} ||= $smtp->host
l!l&&r!l&&!r
300
MC/DC0%0/2
$arg{"SSL_verifycn_name"} ||= $smtp->host
$arg{"SSL_verifycn_name"} $smtp->host
Truth table33%1/3
A ||= B
A= $arg{"SSL_verifycn_name"}B= $smtp->host
ABresult
1X1
011
000
626 =~s{(?<!:):[\w()]+$}{}; # strip port
627 $arg{SSL_hostname} = $arg{SSL_verifycn_name}
628 3 ▶ if ! defined $arg{SSL_hostname} && $class->can_client_sni;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $arg{"SSL_hostname"} and $class->can_client_sni 3 0 3
Condition33%1/3
not defined $arg{"SSL_hostname"} and $class->can_client_sni
!ll&&!rl&&r
003
MC/DC0%0/2
not defined $arg{"SSL_hostname"} and $class->can_client_sni
not defined $arg{"SSL_hostname"} $class->can_client_sni
Truth table33%1/3
not(A) and B
A= not defined $arg{"SSL_hostname"}B= $class->can_client_sni
ABresult
0X0
100
111
629 3 ▶ $arg{SSL_verifycn_scheme} ||= 'smtp';
Condition50%1/2
$arg{"SSL_verifycn_scheme"} ||= "smtp"
l!l
03
MC/DC0%0/1
$arg{"SSL_verifycn_scheme"} ||= "smtp"
$arg{"SSL_verifycn_scheme"}
Truth table50%1/2
A
A= $arg{"SSL_verifycn_scheme"}
Aresult
11
00
630 3 my $ok = $class->SUPER::start_SSL($smtp,%arg);
631 3 ▶ $@ = $ssl_class->errstr if !$ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 3 3
632 3 return $ok;
633 }
634 }
635  
636  
637  
638 6 1;
639  
640 __END__
« Domain.pm ↑ Summary FTP/A.pm »