POP3.pm

filter: Statementstmt 34.2% 105 / 307 Branchbran 14.1% 24 / 170 Conditioncond 14.1% 13 / 92 MC/DCmcdc 1.8% 1 / 53 Subroutinesub 32.7% 19 / 58 Podpod 100% 26 / 26 totaltotal 26.6% 188 / 706 CC 116 SCAR 38.7
CC
116
Cov
25%
auth
272.0
apop
72.0
_lookup_credentials
72.0
CRAP 48.1
« FTP/A.pm ↑ Summary Netrc.pm »
1 # Net::POP3.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::POP3;
10  
11 5 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 5 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 5 ▶use Net::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 5 ▶use Net::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 5 our $VERSION = "3.16";
22  
23 # Code for detecting if we can use SSL
24 5 ▶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"} 'IO::Socket::SSL'->VERSION(2.007) } } && 'IO::Socket::SSL'
!ll
05
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"} '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"} '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"} 'IO::Socket::SSL'->VERSION(2.007) } }
Aresult
00
11
25 5 require IO::Socket::SSL;
26 # first version with default CA on most platforms
27 5 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 5 IO::Socket::SSL->VERSION(2.007);
29 } && 'IO::Socket::SSL';
30  
31 5 ▶my $nossl_warn = !$ssl_class &&
Condition50%1/2
!$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'
!ll
50
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
32 'To use SSL please install IO::Socket::SSL with version>=2.007';
33  
34 # Code for detecting if we can use IPv6
35 5 my $family_key = 'Domain';
36 my $inet6_class = eval {
37 5 require IO::Socket::IP;
38 5 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
39 5 ▶ IO::Socket::IP->VERSION(0.25) || die;
Branch: 1 branch
BranchTrueFalseTotal
"IO::Socket::IP"->VERSION("0.25") or die 5 0 5
40 5 ▶ $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"} "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"} "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"} "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"} "IO::Socket::INET6"->VERSION("2.62") } }
Aresult
00
11
41 5 ▶} && '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"} '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"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
l!l&&r!l&&!r
500
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"} "IO::Socket::IP"->VERSION("0.25") or die; $family_key = "Family" } } and "IO::Socket::IP"
!ll
05
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"} '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"} '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"} "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"} '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"} "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"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
ABresult
1X1
011
000
42 0 require IO::Socket::INET6;
43 5 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
44 0 IO::Socket::INET6->VERSION(2.62);
45 } && 'IO::Socket::INET6';
46  
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 5 ▶our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET');
Condition50%1/2
$inet6_class || 'IO::Socket::INET'
l!l
50
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=18 SCAR=32.5
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 3 ▶ my $hosts = defined $host ? [$host] : $NetConfig{pop3_hosts};
Branch: 1 branch
BranchTrueFalseTotal
defined $host ? : 3 0 3
66 3 my $obj;
67  
68 3 ▶ if ($arg{SSL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg{"SSL"}) 2 1 3
69 # SSL from start
70 2 ▶ die $nossl_warn if !$ssl_class;
Branch: 1 branch
BranchTrueFalseTotal
unless $ssl_class 0 2 2
71 2 ▶ $arg{Port} ||= 995;
Condition50%1/2
$arg{"Port"} ||= 995
l!l
02
MC/DC0%0/1
$arg{"Port"} ||= 995
$arg{"Port"}
Truth table50%1/2
A
A= $arg{"Port"}
Aresult
11
00
72 }
73  
74 3 ▶ $arg{Timeout} = 120 if ! defined $arg{Timeout};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg{"Timeout"} 3 0 3
75  
76 3 foreach my $h (@{$hosts}) {
77 $obj = $type->SUPER::new(
78 PeerAddr => ($host = $h),
79 PeerPort => $arg{Port} || 'pop3(110)',
80 Proto => 'tcp',
81 $family_key => $arg{Domain} || $arg{Family},
82 LocalAddr => $arg{LocalAddr},
83 LocalPort => exists($arg{ResvPort}) ? $arg{ResvPort} : $arg{LocalPort},
84 Timeout => $arg{Timeout},
85 )
86 3 ▶ and last;
Branch: 2 branches
BranchTrueFalseTotal
$obj = $type->SUPER::new("PeerAddr", $host = $h, "PeerPort", $arg{"Port"} || "pop3(110)", "Proto", "tcp", $family_key, $arg{"Domain"} || $arg{"Family"}, "LocalAddr", $arg{"LocalAddr"}, "LocalPort", exists $arg{"ResvPort"} ? $arg{"ResvPort"} : $arg{"LocalPort"}, "Timeout", $arg{"Timeout"}) and last 3 0 3
exists $arg{'ResvPort'} ? : 0 3 3
Condition60%3/5
$arg{'Port'} || 'pop3(110)'
l!l
21
$arg{'Domain'} || $arg{'Family'}
l!l&&r!l&&!r
003
MC/DC100%1/1
$arg{'Port'} || 'pop3(110)'
$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
87 }
88  
89 return
90 3 ▶ unless defined $obj;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $obj 0 3 3
91  
92 3 ${*$obj}{'net_pop3_arg'} = \%arg;
93 3 ${*$obj}{'net_pop3_host'} = $host;
94 3 ▶ if ($arg{SSL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg{"SSL"}) 2 1 3
95 2 ▶ Net::POP3::_SSL->start_SSL($obj,%arg) or return;
Branch: 1 branch
BranchTrueFalseTotal
"Net::POP3::_SSL"->start_SSL($obj, %arg) or return 2 0 2
96 }
97  
98 3 $obj->autoflush(1);
99 3 ▶ $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef);
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'Debug'} ? : 3 0 3
100  
101 3 ▶ unless ($obj->response() == CMD_OK) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->response == 2) 0 3 3
102 0 $obj->close();
103 0 return;
104 }
105  
106 3 ${*$obj}{'net_pop3_banner'} = $obj->message;
107  
108 3 $obj;
109 }
110  
111  
112 0 ▶sub host {
Subroutine host: not called CC=1 SCAR=6.9
Pod documented
113 0 my $me = shift;
114 0 ${*$me}{'net_pop3_host'};
115 }
116  
117 ##
118 ## We don't want people sending me their passwords when they report problems
119 ## now do we :-)
120 ##
121  
122  
123 0 ▶sub debug_text { $_[2] =~ /^(pass|rpop)/i ? "$1 ....\n" : $_[2]; }
Subroutine debug_text: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[2] =~ /^(pass|rpop)/i ? : 0 0 0
124  
125  
126 0 ▶sub login {
Subroutine login: not called CC=5 SCAR=34.0
Pod documented
127 0 ▶ @_ >= 1 && @_ <= 3 or croak 'usage: $pop3->login([$user[, $pass]])';
Branch: 1 branch
BranchTrueFalseTotal
@_ >= 1 and @_ <= 3 or croak("usage: \$pop3->login([\$user[, \$pass]])") 0 0 0
Condition0%0/3
@_ >= 1 and @_ <= 3
!ll&&!rl&&r
000
MC/DC0%0/2
@_ >= 1 and @_ <= 3
@_ >= 1 @_ <= 3
Truth table0%0/3
A and B
A= @_ >= 1B= @_ <= 3
ABresult
0X0
100
111
128 0 my ($me, $user, $pass) = @_;
129  
130 0 ▶ if (@_ <= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ <= 2) 0 0 0
131 0 ($user, $pass) = $me->_lookup_credentials($user);
132 }
133  
134 0 ▶ $me->user($user)
Branch: 1 branch
BranchTrueFalseTotal
$me->user($user) and $me->pass($pass) 0 0 0
135 and $me->pass($pass);
136 }
137  
138 1 ▶sub starttls {
Subroutine starttls: called CC=4 SCAR=14.3
Pod documented
139 1 my $self = shift;
140 1 ▶ $ssl_class or die $nossl_warn;
Branch: 1 branch
BranchTrueFalseTotal
$ssl_class or die $nossl_warn 1 0 1
141 1 ▶ $self->_STLS or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->_STLS or return 1 0 1
142 Net::POP3::_SSL->start_SSL($self,
143 1 ▶ %{ ${*$self}{'net_pop3_arg'} }, # (ssl) args given in new
Branch: 1 branch
BranchTrueFalseTotal
"Net::POP3::_SSL"->start_SSL($self, %{${*$self;}{"net_pop3_arg"};}, @_) or return 1 0 1
144 @_ # more (ssl) args
145 ) or return;
146 1 return 1;
147 }
148  
149 0 ▶sub apop {
Subroutine apop: not called CC=8 SCAR=42.8
Pod documented
150 0 ▶ @_ >= 1 && @_ <= 3 or croak 'usage: $pop3->apop([$user[, $pass]])';
Branch: 1 branch
BranchTrueFalseTotal
@_ >= 1 and @_ <= 3 or croak("usage: \$pop3->apop([\$user[, \$pass]])") 0 0 0
Condition0%0/3
@_ >= 1 and @_ <= 3
!ll&&!rl&&r
000
MC/DC0%0/2
@_ >= 1 and @_ <= 3
@_ >= 1 @_ <= 3
Truth table0%0/3
A and B
A= @_ >= 1B= @_ <= 3
ABresult
0X0
100
111
151 0 my ($me, $user, $pass) = @_;
152 0 my $banner;
153 my $md;
154  
155 0 ▶ if (eval { local $SIG{__DIE__}; require Digest::MD5 }) {
Branch: 2 branches
BranchTrueFalseTotal
if (eval { do { local $SIG{'__DIE__'}; require Digest::MD5 } }) { } 0 0 0
elsif (eval { do { local $SIG{'__DIE__'}; require MD5 } }) { } 0 0 0
156 0 $md = Digest::MD5->new();
157 }
158 0 elsif (eval { local $SIG{__DIE__}; require MD5 }) {
159 0 $md = MD5->new();
160 }
161 else {
162 0 carp "You need to install Digest::MD5 or MD5 to use the APOP command";
163 0 return;
164 }
165  
166 return
167 0 ▶ unless ($banner = (${*$me}{'net_pop3_banner'} =~ /(<.*>)/)[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless $banner = (do { *$me }->{"net_pop3_banner"} =~ /(<.*>)/)[0] 0 0 0
168  
169 0 ▶ if (@_ <= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ <= 2) 0 0 0
170 0 ($user, $pass) = $me->_lookup_credentials($user);
171 }
172  
173 0 $md->add($banner, $pass);
174  
175 return
176 0 ▶ unless ($me->_APOP($user, $md->hexdigest));
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_APOP($user, $md->hexdigest) 0 0 0
177  
178 0 $me->_get_mailbox_count();
179 }
180  
181  
182 0 ▶sub user {
Subroutine user: not called CC=3 SCAR=24.8
Pod documented
183 0 ▶ @_ == 2 or croak 'usage: $pop3->user($user)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$pop3->user(\$user)") 0 0 0
184 0 ▶ $_[0]->_USER($_[1]) ? 1 : undef;
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->_USER($_[1]) ? : 0 0 0
185 }
186  
187  
188 0 ▶sub pass {
Subroutine pass: not called CC=3 SCAR=24.8
Pod documented
189 0 ▶ @_ == 2 or croak 'usage: $pop3->pass($pass)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$pop3->pass(\$pass)") 0 0 0
190  
191 0 my ($me, $pass) = @_;
192  
193 return
194 0 ▶ unless ($me->_PASS($pass));
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_PASS($pass) 0 0 0
195  
196 0 $me->_get_mailbox_count();
197 }
198  
199  
200 0 ▶sub reset {
Subroutine reset: not called CC=5 SCAR=34.0
Pod documented
201 0 ▶ @_ == 1 or croak 'usage: $obj->reset()';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("usage: \$obj->reset()") 0 0 0
202  
203 0 my $me = shift;
204  
205 0 ▶ return 0
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_RSET 0 0 0
206 unless ($me->_RSET);
207  
208 0 ▶ if (defined ${*$me}{'net_pop3_mail'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined do { *$me }->{"net_pop3_mail"}) 0 0 0
209 0 local $_;
210 0 foreach (@{${*$me}{'net_pop3_mail'}}) {
211 0 delete $_->{'net_pop3_deleted'};
212 }
213 }
214 }
215  
216  
217 0 ▶sub last {
Subroutine last: not called CC=4 SCAR=30.0
Pod documented
218 0 ▶ @_ == 1 or croak 'usage: $obj->last()';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("usage: \$obj->last()") 0 0 0
219  
220 return
221 0 ▶ unless $_[0]->_LAST && $_[0]->message =~ /(\d+)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->_LAST and $_[0]->message =~ /(\d+)/ 0 0 0
Condition0%0/3
$_[0]->_LAST and $_[0]->message =~ /(\d+)/
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0]->_LAST and $_[0]->message =~ /(\d+)/
$_[0]->_LAST $_[0]->message =~ /(\d+)/
Truth table0%0/3
A and B
A= $_[0]->_LASTB= $_[0]->message =~ /(\d+)/
ABresult
0X0
100
111
222  
223 0 return $1;
224 }
225  
226  
227 0 ▶sub top {
Subroutine top: not called CC=5 SCAR=34.0
Pod documented
228 0 ▶ @_ == 2 || @_ == 3 or croak 'usage: $pop3->top($msgnum[, $numlines])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or @_ == 3 or croak("usage: \$pop3->top(\$msgnum[, \$numlines])") 0 0 0
Condition0%0/3
@_ == 2 or @_ == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 2 or @_ == 3
@_ == 2 @_ == 3
Truth table0%0/3
A or B
A= @_ == 2B= @_ == 3
ABresult
1X1
011
000
229 0 my $me = shift;
230  
231 return
232 0 ▶ unless $me->_TOP($_[0], $_[1] || 0);
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_TOP($_[0], $_[1] || 0) 0 0 0
Condition0%0/2
$_[1] || 0
l!l
00
MC/DC0%0/1
$_[1] || 0
$_[1]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
233  
234 0 $me->read_until_dot;
235 }
236  
237  
238 0 ▶sub popstat {
Subroutine popstat: not called CC=6 SCAR=37.4
Pod documented
239 0 ▶ @_ == 1 or croak 'usage: $pop3->popstat()';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("usage: \$pop3->popstat()") 0 0 0
240 0 my $me = shift;
241  
242 return ()
243 0 ▶ unless $me->_STAT && $me->message =~ /(\d+)\D+(\d+)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_STAT and $me->message =~ /(\d+)\D+(\d+)/ 0 0 0
Condition0%0/3
$me->_STAT and $me->message =~ /(\d+)\D+(\d+)/
!ll&&!rl&&r
000
MC/DC0%0/2
$me->_STAT and $me->message =~ /(\d+)\D+(\d+)/
$me->_STAT $me->message =~ /(\d+)\D+(\d+)/
Truth table0%0/3
A and B
A= $me->_STATB= $me->message =~ /(\d+)\D+(\d+)/
ABresult
0X0
100
111
244  
245 0 ▶ ($1 || 0, $2 || 0);
Branch: 2 branches
BranchTrueFalseTotal
$1 or 0 0 0 0
$2 or 0 0 0 0
246 }
247  
248  
249 0 ▶sub list {
Subroutine list: not called CC=7 SCAR=40.3
Pod documented
250 0 ▶ @_ == 1 || @_ == 2 or croak 'usage: $pop3->list([$msgnum])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or @_ == 2 or croak("usage: \$pop3->list([\$msgnum])") 0 0 0
Condition0%0/3
@_ == 1 or @_ == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 1 or @_ == 2
@_ == 1 @_ == 2
Truth table0%0/3
A or B
A= @_ == 1B= @_ == 2
ABresult
1X1
011
000
251 0 my $me = shift;
252  
253 return
254 0 ▶ unless $me->_LIST(@_);
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_LIST(@_) 0 0 0
255  
256 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
257 0 $me->message =~ /\d+\D+(\d+)/;
258 0 ▶ return $1 || undef;
Condition0%0/2
$1 || undef
l!l
00
MC/DC0%0/1
$1 || undef
$1
Truth table0%0/2
A
A= $1
Aresult
11
00
259 }
260  
261 0 ▶ my $info = $me->read_until_dot
Branch: 1 branch
BranchTrueFalseTotal
my $info = $me->read_until_dot or return 0 0 0
262 or return;
263  
264 0 my %hash = map { (/(\d+)\D+(\d+)/) } @$info;
265  
266 0 return \%hash;
267 }
268  
269  
270 0 ▶sub get {
Subroutine get: not called CC=4 SCAR=30.0
Pod documented
271 0 ▶ @_ == 2 or @_ == 3 or croak 'usage: $pop3->get($msgnum[, $fh])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or @_ == 3 or croak("usage: \$pop3->get(\$msgnum[, \$fh])") 0 0 0
Condition0%0/3
@_ == 2 or @_ == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 2 or @_ == 3
@_ == 2 @_ == 3
Truth table0%0/3
A or B
A= @_ == 2B= @_ == 3
ABresult
1X1
011
000
272 0 my $me = shift;
273  
274 return
275 0 ▶ unless $me->_RETR(shift);
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_RETR(shift()) 0 0 0
276  
277 0 $me->read_until_dot(@_);
278 }
279  
280  
281 0 ▶sub getfh {
Subroutine getfh: not called CC=3 SCAR=24.8
Pod documented
282 0 ▶ @_ == 2 or croak 'usage: $pop3->getfh($msgnum)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$pop3->getfh(\$msgnum)") 0 0 0
283 0 my $me = shift;
284  
285 0 ▶ return unless $me->_RETR(shift);
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_RETR(shift()) 0 0 0
286 0 return $me->tied_fh;
287 }
288  
289  
290 0 ▶sub delete {
Subroutine delete: not called CC=3 SCAR=24.8
Pod documented
291 0 ▶ @_ == 2 or croak 'usage: $pop3->delete($msgnum)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$pop3->delete(\$msgnum)") 0 0 0
292 0 my $me = shift;
293 0 ▶ return 0 unless $me->_DELE(@_);
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_DELE(@_) 0 0 0
294 0 ${*$me}{'net_pop3_deleted'} = 1;
295 }
296  
297  
298 0 ▶sub uidl {
Subroutine uidl: not called CC=7 SCAR=40.3
Pod documented
299 0 ▶ @_ == 1 || @_ == 2 or croak 'usage: $pop3->uidl([$msgnum])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or @_ == 2 or croak("usage: \$pop3->uidl([\$msgnum])") 0 0 0
Condition0%0/3
@_ == 1 or @_ == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 1 or @_ == 2
@_ == 1 @_ == 2
Truth table0%0/3
A or B
A= @_ == 1B= @_ == 2
ABresult
1X1
011
000
300 0 my $me = shift;
301 0 my $uidl;
302  
303 0 ▶ $me->_UIDL(@_)
Branch: 1 branch
BranchTrueFalseTotal
$me->_UIDL(@_) or return 0 0 0
304 or return;
305 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
306 0 $uidl = ($me->message =~ /\d+\s+([\041-\176]+)/)[0];
307 }
308 else {
309 0 ▶ my $ref = $me->read_until_dot
Branch: 1 branch
BranchTrueFalseTotal
my $ref = $me->read_until_dot or return 0 0 0
310 or return;
311 0 $uidl = {};
312 0 foreach my $ln (@$ref) {
313 0 my ($msg, $uid) = $ln =~ /^\s*(\d+)\s+([\041-\176]+)/;
314 0 $uidl->{$msg} = $uid;
315 }
316 }
317 0 return $uidl;
318 }
319  
320  
321 0 ▶sub ping {
Subroutine ping: not called CC=6 SCAR=37.4
Pod documented
322 0 ▶ @_ == 2 or croak 'usage: $pop3->ping($user)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$pop3->ping(\$user)") 0 0 0
323 0 my $me = shift;
324  
325 0 ▶ return () unless $me->_PING(@_) && $me->message =~ /(\d+)\D+(\d+)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $me->_PING(@_) and $me->message =~ /(\d+)\D+(\d+)/ 0 0 0
Condition0%0/3
$me->_PING(@_) and $me->message =~ /(\d+)\D+(\d+)/
!ll&&!rl&&r
000
MC/DC0%0/2
$me->_PING(@_) and $me->message =~ /(\d+)\D+(\d+)/
$me->_PING(@_) $me->message =~ /(\d+)\D+(\d+)/
Truth table0%0/3
A and B
A= $me->_PING(@_)B= $me->message =~ /(\d+)\D+(\d+)/
ABresult
0X0
100
111
326  
327 0 ▶ ($1 || 0, $2 || 0);
Branch: 2 branches
BranchTrueFalseTotal
$1 or 0 0 0 0
$2 or 0 0 0 0
328 }
329  
330  
331 0 ▶sub _lookup_credentials {
Subroutine _lookup_credentials: not called CC=8 SCAR=42.8
332 0 my ($me, $user) = @_;
333  
334 0 require Net::Netrc;
335  
336 0 $user ||= eval { local $SIG{__DIE__}; (getpwuid($>))[0] }
337 || $ENV{NAME}
338 || $ENV{USER}
339 0 ▶ || $ENV{LOGNAME};
Condition0%0/12
$user ||= eval { do { local $SIG{"__DIE__"}; (getpwuid $>)[0] } } || $ENV{"NAME"} || $ENV{"USER"} || $ENV{"LOGNAME"}
l!l&&r!l&&!r
000
eval { do { local $SIG{'__DIE__'}; (getpwuid $>)[0] } } || $ENV{'NAME'} || $ENV{'USER'} || $ENV{'LOGNAME'}
l!l&&r!l&&!r
000
eval { do { local $SIG{"__DIE__"}; (getpwuid $>)[0] } } or $ENV{"NAME"} or $ENV{"USER"}
l!l&&r!l&&!r
000
eval { do { local $SIG{"__DIE__"}; (getpwuid $>)[0] } } or $ENV{"NAME"}
l!l&&r!l&&!r
000
MC/DC0%0/5
$user ||= eval { do { local $SIG{"__DIE__"}; (getpwuid $>)[0] } } || $ENV{"NAME"} || $ENV{"USER"} || $ENV{"LOGNAME"}
$user eval { do { local $SIG{"__DIE__"}; (getpwuid $>)[0] } } $ENV{"NAME"} $ENV{"USER"} $ENV{'LOGNAME'}
Truth table0%0/6
A ||= B or C or D || E
A= $userB= eval { do { local $SIG{"__DIE__"}; (getpwuid $>)[0] } }C= $ENV{"NAME"}D= $ENV{"USER"}E= $ENV{'LOGNAME'}
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
340  
341 0 my $m = Net::Netrc->lookup(${*$me}{'net_pop3_host'}, $user);
342 0 ▶ $m ||= Net::Netrc->lookup(${*$me}{'net_pop3_host'});
Condition0%0/3
$m ||= "Net::Netrc"->lookup(do { *$me }->{"net_pop3_host"})
l!l&&r!l&&!r
000
MC/DC0%0/2
$m ||= "Net::Netrc"->lookup(do { *$me }->{"net_pop3_host"})
$m "Net::Netrc"->lookup(do { *$me }->{"net_pop3_host"})
Truth table0%0/3
A ||= B
A= $mB= "Net::Netrc"->lookup(do { *$me }->{"net_pop3_host"})
ABresult
1X1
011
000
343  
344 0 ▶ my $pass = $m
Branch: 1 branch
BranchTrueFalseTotal
$m ? : 0 0 0
Condition0%0/2
$m->password or ""
l!l
00
MC/DC0%0/1
$m->password or ""
$m->password
Truth table0%0/2
A
A= $m->password
Aresult
11
00
345 ? $m->password || ""
346 : "";
347  
348 0 ($user, $pass);
349 }
350  
351  
352 0 ▶sub _get_mailbox_count {
Subroutine _get_mailbox_count: not called CC=3 SCAR=24.8
353 0 my ($me) = @_;
354 0 ▶ my $ret = ${*$me}{'net_pop3_count'} =
Branch: 1 branch
BranchTrueFalseTotal
$me->message =~ /(\d+)\s+message/io ? : 0 0 0
355 ($me->message =~ /(\d+)\s+message/io) ? $1 : ($me->popstat)[0];
356  
357 0 ▶ $ret ? $ret : "0E0";
Branch: 1 branch
BranchTrueFalseTotal
$ret ? : 0 0 0
358 }
359  
360  
361 0 ▶sub _STAT { shift->command('STAT' )->response() == CMD_OK }
Subroutine _STAT: not called CC=1 SCAR=6.9
362 0 ▶sub _LIST { shift->command('LIST', @_)->response() == CMD_OK }
Subroutine _LIST: not called CC=1 SCAR=6.9
363 0 ▶sub _RETR { shift->command('RETR', $_[0])->response() == CMD_OK }
Subroutine _RETR: not called CC=1 SCAR=6.9
364 0 ▶sub _DELE { shift->command('DELE', $_[0])->response() == CMD_OK }
Subroutine _DELE: not called CC=1 SCAR=6.9
365 0 ▶sub _NOOP { shift->command('NOOP' )->response() == CMD_OK }
Subroutine _NOOP: not called CC=1 SCAR=6.9
366 0 ▶sub _RSET { shift->command('RSET' )->response() == CMD_OK }
Subroutine _RSET: not called CC=1 SCAR=6.9
367 3 ▶sub _QUIT { shift->command('QUIT' )->response() == CMD_OK }
Subroutine _QUIT: called CC=1 SCAR=0.0
368 0 ▶sub _TOP { shift->command( 'TOP', @_)->response() == CMD_OK }
Subroutine _TOP: not called CC=1 SCAR=6.9
369 0 ▶sub _UIDL { shift->command('UIDL', @_)->response() == CMD_OK }
Subroutine _UIDL: not called CC=1 SCAR=6.9
370 0 ▶sub _USER { shift->command('USER', $_[0])->response() == CMD_OK }
Subroutine _USER: not called CC=1 SCAR=6.9
371 0 ▶sub _PASS { shift->command('PASS', $_[0])->response() == CMD_OK }
Subroutine _PASS: not called CC=1 SCAR=6.9
372 0 ▶sub _APOP { shift->command('APOP', @_)->response() == CMD_OK }
Subroutine _APOP: not called CC=1 SCAR=6.9
373 0 ▶sub _PING { shift->command('PING', $_[0])->response() == CMD_OK }
Subroutine _PING: not called CC=1 SCAR=6.9
374 0 ▶sub _RPOP { shift->command('RPOP', $_[0])->response() == CMD_OK }
Subroutine _RPOP: not called CC=1 SCAR=6.9
375 0 ▶sub _LAST { shift->command('LAST' )->response() == CMD_OK }
Subroutine _LAST: not called CC=1 SCAR=6.9
376 0 ▶sub _CAPA { shift->command('CAPA' )->response() == CMD_OK }
Subroutine _CAPA: not called CC=1 SCAR=6.9
377 1 ▶sub _STLS { shift->command("STLS", )->response() == CMD_OK }
Subroutine _STLS: called CC=1 SCAR=0.0
378  
379  
380 3 ▶sub quit {
Subroutine quit: called CC=1 SCAR=0.0
Pod documented
381 3 my $me = shift;
382  
383 3 $me->_QUIT;
384 3 $me->close;
385 }
386  
387  
388 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=3 SCAR=24.8
389 0 my $me = shift;
390  
391 0 ▶ if (defined fileno($me) and ${*$me}{'net_pop3_deleted'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined fileno $me and do { *$me }->{"net_pop3_deleted"}) 0 0 0
Condition0%0/3
defined fileno $me and do { *$me }->{"net_pop3_deleted"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined fileno $me and do { *$me }->{"net_pop3_deleted"}
defined fileno $me do { *$me }->{"net_pop3_deleted"}
Truth table0%0/3
A and B
A= defined fileno $meB= do { *$me }->{"net_pop3_deleted"}
ABresult
0X0
100
111
392 0 $me->reset;
393 0 $me->quit;
394 }
395 }
396  
397 ##
398 ## POP3 has weird responses, so we emulate them to look the same :-)
399 ##
400  
401  
402 7 ▶sub response {
Subroutine response: called CC=5 SCAR=17.8
Pod documented
403 7 my $cmd = shift;
404 7 ▶ my $str = $cmd->getline() or return;
Branch: 1 branch
BranchTrueFalseTotal
my $str = $cmd->getline or return 7 0 7
405 7 my $code = "500";
406  
407 7 ▶ $cmd->debug_print(0, $str)
Branch: 1 branch
BranchTrueFalseTotal
if $cmd->debug 0 7 7
408 if ($cmd->debug);
409  
410 7 ▶ if ($str =~ s/^\+OK\s*//io) {
Branch: 2 branches
BranchTrueFalseTotal
if ($str =~ s/^\+OK\s*//io) { } 7 0 7
elsif ($str =~ s/^\+\s*//io) { } 0 0 0
411 7 $code = "200";
412 }
413 elsif ($str =~ s/^\+\s*//io) {
414 0 $code = "300";
415 }
416 else {
417 0 $str =~ s/^-ERR\s*//io;
418 }
419  
420 7 ${*$cmd}{'net_cmd_resp'} = [$str];
421 7 ${*$cmd}{'net_cmd_code'} = $code;
422  
423 7 substr($code, 0, 1);
424 }
425  
426  
427 0 ▶sub capa {
Subroutine capa: not called CC=4 SCAR=30.0
Pod documented
428 0 my $this = shift;
429 0 my ($capa, %capabilities);
430  
431 # Fake a capability here
432 0 ▶ $capabilities{APOP} = '' if ($this->banner() =~ /<.*>/);
Branch: 1 branch
BranchTrueFalseTotal
if $this->banner =~ /<.*>/ 0 0 0
433  
434 0 ▶ if ($this->_CAPA()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($this->_CAPA) { } 0 0 0
435 0 $capabilities{CAPA} = 1;
436 0 $capa = $this->read_until_dot();
437 0 %capabilities = (%capabilities, map {/^\s*(\S+)\s*(.*)/} @$capa);
438 }
439 else {
440  
441 # Check AUTH for SASL capabilities
442 0 ▶ if ($this->command('AUTH')->response() == CMD_OK) {
Branch: 1 branch
BranchTrueFalseTotal
if ($this->command("AUTH")->response == 2) 0 0 0
443 0 my $mechanism = $this->read_until_dot();
444 0 $capabilities{SASL} = join " ", map {m/([A-Z0-9_-]+)/} @{$mechanism};
445 }
446 }
447  
448 0 return ${*$this}{'net_pop3e_capabilities'} = \%capabilities;
449 }
450  
451  
452 0 ▶sub capabilities {
Subroutine capabilities: not called CC=2 SCAR=17.9
Pod documented
453 0 my $this = shift;
454  
455 0 ▶ ${*$this}{'net_pop3e_capabilities'} || $this->capa;
Branch: 1 branch
BranchTrueFalseTotal
do { *$this }->{"net_pop3e_capabilities"} or $this->capa 0 0 0
456 }
457  
458  
459 0 ▶sub auth {
Subroutine auth: not called CC=16 SCAR=56.1
Pod documented
460 0 my ($self, $username, $password) = @_;
461  
462 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
463 0 require MIME::Base64;
464 0 require Authen::SASL;
465 } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0;
466  
467 0 my $capa = $self->capa;
468 0 ▶ my $mechanisms = $capa->{SASL} || 'CRAM-MD5';
Condition0%0/2
$capa->{'SASL'} || 'CRAM-MD5'
l!l
00
MC/DC0%0/1
$capa->{'SASL'} || 'CRAM-MD5'
$capa->{'SASL'}
Truth table0%0/2
A
A= $capa->{'SASL'}
Aresult
11
00
469  
470 0 my $sasl;
471  
472 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
473 0 $sasl = $username;
474 0 ▶ my $user_mech = $sasl->mechanism || '';
Condition0%0/2
$sasl->mechanism || ''
l!l
00
MC/DC0%0/1
$sasl->mechanism || ''
$sasl->mechanism
Truth table0%0/2
A
A= $sasl->mechanism
Aresult
11
00
475 0 my @user_mech = split(/\s+/, $user_mech);
476 0 my %user_mech;
477 0 @user_mech{@user_mech} = ();
478  
479 0 my @server_mech = split(/\s+/, $mechanisms);
480 my @mech = @user_mech
481 0 ▶ ? grep { exists $user_mech{$_} } @server_mech
Branch: 1 branch
BranchTrueFalseTotal
@user_mech ? : 0 0 0
482 : @server_mech;
483 0 ▶ unless (@mech) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@mech) 0 0 0
484 0 $self->set_status(
485 500,
486 [ 'Client SASL mechanisms (',
487 join(', ', @user_mech),
488 ') do not match the SASL mechnism the server announces (',
489 join(', ', @server_mech), ')',
490 ]
491 );
492 0 return 0;
493 }
494  
495 0 $sasl->mechanism(join(" ", @mech));
496 }
497 else {
498 0 ▶ die "auth(username, password)" if not length $username;
Branch: 1 branch
BranchTrueFalseTotal
unless length $username 0 0 0
499 0 $sasl = Authen::SASL->new(
500 mechanism => $mechanisms,
501 callback => {
502 user => $username,
503 pass => $password,
504 authname => $username,
505 }
506 );
507 }
508  
509 # We should probably allow the user to pass the host, but I don't
510 # currently know and SASL mechanisms that are used by smtp that need it
511 0 my ($hostname) = split /:/, ${*$self}{'net_pop3_host'};
512 0 my $client = eval { $sasl->client_new('pop', $hostname, 0) };
513  
514 0 ▶ unless ($client) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($client) 0 0 0
515 0 my $mech = $sasl->mechanism;
516 0 $self->set_status(
517 500,
518 [ " Authen::SASL failure: $@",
519 '(please check if your local Authen::SASL installation',
520 "supports mechanism '$mech'"
521 ]
522 );
523 0 return 0;
524 }
525  
526 my ($token) = $client->client_start
527 0 ▶ or do {
Branch: 1 branch
BranchTrueFalseTotal
my($token) = $client->client_start or do { my $mech = $client->mechanism; $self->set_status(500, [" Authen::SASL failure: \$client->client_start ", "mechanism '${mech}' hostname #$hostname#", $client->error]); return 0 } 0 0 0
528 0 my $mech = $client->mechanism;
529 0 $self->set_status(
530 500,
531 [ ' Authen::SASL failure: $client->client_start ',
532 "mechanism '$mech' hostname #$hostname#",
533 $client->error
534 ]
535 );
536 0 return 0;
537 };
538  
539 # We don't support sasl mechanisms that encrypt the socket traffic.
540 # todo that we would really need to change the ISA hierarchy
541 # so we don't inherit from IO::Socket, but instead hold it in an attribute
542  
543 0 my @cmd = ("AUTH", $client->mechanism);
544 0 my $code;
545  
546 0 ▶ push @cmd, MIME::Base64::encode_base64($token, '')
Branch: 1 branch
BranchTrueFalseTotal
if defined $token and length $token 0 0 0
Condition0%0/3
defined $token and length $token
!ll&&!rl&&r
000
MC/DC0%0/2
defined $token and length $token
defined $token length $token
Truth table0%0/3
A and B
A= defined $tokenB= length $token
ABresult
0X0
100
111
547 if defined $token and length $token;
548  
549 0 ▶ while (($code = $self->command(@cmd)->response()) == CMD_MORE) {
Branch: 1 branch
BranchTrueFalseTotal
if (($code = $self->command(@cmd)->response) == 3) 0 0 0
550  
551 0 ▶ my ($token) = $client->client_step(MIME::Base64::decode_base64(($self->message)[0])) or do {
Branch: 1 branch
BranchTrueFalseTotal
my($token) = $client->client_step(MIME::Base64::decode_base64(($self->message)[0])) or do { $self->set_status(500, [" Authen::SASL failure: \$client->client_step ", "mechanism '", $client->mechanism, " hostname #$hostname#, ", $client->error]); return 0 } 0 0 0
552 0 $self->set_status(
553 500,
554 [ ' Authen::SASL failure: $client->client_step ',
555 "mechanism '", $client->mechanism, " hostname #$hostname#, ",
556 $client->error
557 ]
558 );
559 0 return 0;
560 };
561  
562 0 ▶ @cmd = (MIME::Base64::encode_base64(defined $token ? $token : '', ''));
Branch: 1 branch
BranchTrueFalseTotal
defined $token ? : 0 0 0
563 }
564  
565 0 $code == CMD_OK;
566 }
567  
568  
569 0 ▶sub banner {
Subroutine banner: not called CC=1 SCAR=6.9
Pod documented
570 0 my $this = shift;
571  
572 0 return ${*$this}{'net_pop3_banner'};
573 }
574  
575 {
576 package Net::POP3::_SSL;
577 5 ▶ our @ISA = ( $ssl_class ? ($ssl_class):(), 'Net::POP3' );
Branch: 1 branch
BranchTrueFalseTotal
$ssl_class ? : 5 0 5
578 0 ▶ sub starttls { die "POP3 connection is already in SSL mode" }
Subroutine starttls: not called CC=1 SCAR=6.9
579 3 ▶ sub start_SSL {
Subroutine start_SSL: called CC=6 SCAR=19.9
580 3 my ($class,$pop3,%arg) = @_;
581 3 delete @arg{ grep { !m{^SSL_} } keys %arg };
582 3 ▶ ( $arg{SSL_verifycn_name} ||= $pop3->host )
Condition33%1/3
$arg{"SSL_verifycn_name"} ||= $pop3->host
l!l&&r!l&&!r
300
MC/DC0%0/2
$arg{"SSL_verifycn_name"} ||= $pop3->host
$arg{"SSL_verifycn_name"} $pop3->host
Truth table33%1/3
A ||= B
A= $arg{"SSL_verifycn_name"}B= $pop3->host
ABresult
1X1
011
000
583 =~s{(?<!:):[\w()]+$}{}; # strip port
584 $arg{SSL_hostname} = $arg{SSL_verifycn_name}
585 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
586 3 ▶ $arg{SSL_verifycn_scheme} ||= 'pop3';
Condition50%1/2
$arg{"SSL_verifycn_scheme"} ||= "pop3"
l!l
03
MC/DC0%0/1
$arg{"SSL_verifycn_scheme"} ||= "pop3"
$arg{"SSL_verifycn_scheme"}
Truth table50%1/2
A
A= $arg{"SSL_verifycn_scheme"}
Aresult
11
00
587 3 my $ok = $class->SUPER::start_SSL($pop3,%arg);
588 3 ▶ $@ = $ssl_class->errstr if !$ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 3 3
589 3 return $ok;
590 }
591 }
592  
593  
594  
595 5 1;
596  
597 __END__
« FTP/A.pm ↑ Summary Netrc.pm »