blib/lib/Email/Folder/POP3.pm

filter: Statementstmt 46.3% 19 / 41 Branchbran 0.0% 0 / 10 Conditioncond 14.2% 1 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 62.5% 5 / 8 Podpod 100% 1 / 1 totaltotal 36.6% 26 / 71 CC 8 SCAR 29.3
CC
8
Cov
34%
_server
42.0
_uri
6.0
next_message
6.0
CRAP 18.7
↑ Summary
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Email::Folder::POP3;
4 {
5 1 $Email::Folder::POP3::VERSION = '1.015';
6 }
7 # ABSTRACT: Email::Folder Access to POP3 Folders
8  
9 1 ▶our $POP3 ||= 'Net::POP3';
Condition50%1/2
our $POP3 ||= "Net::POP3"
l!l
01
MC/DC0%0/1
our $POP3 ||= "Net::POP3"
our $POP3
Truth table50%1/2
A
A= our $POP3
Aresult
11
00
10  
11 1 ▶use parent qw[Email::Folder::Reader];
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Net::POP3;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶sub _uri {
Subroutine _uri: not called CC=2 SCAR=17.9
16 0 my $self = shift;
17 0 ▶ return $self->{_uri} ||= URI->new($self->{_file});
Condition0%0/3
$self->{"_uri"} ||= "URI"->new($self->{"_file"})
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"_uri"} ||= "URI"->new($self->{"_file"})
$self->{"_uri"} "URI"->new($self->{"_file"})
Truth table0%0/3
A ||= B
A= $self->{"_uri"}B= "URI"->new($self->{"_file"})
ABresult
1X1
011
000
18 }
19  
20 0 ▶sub _server {
Subroutine _server: not called CC=6 SCAR=37.4
21 0 my $self = shift;
22 0 ▶ return $self->{_server} if $self->{_server};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_server"} 0 0 0
23  
24 0 my $uri = $self->_uri;
25 0 my $host = $uri->host;
26 0 ▶ my $port = $uri->port || 110;
Condition0%0/2
$uri->port || 110
l!l
00
MC/DC0%0/1
$uri->port || 110
$uri->port
Truth table0%0/2
A
A= $uri->port
Aresult
11
00
27 0 ▶ my $server = $POP3->new($host, Port => $port, Timeout => 60)
Branch: 1 branch
BranchTrueFalseTotal
my $server = $Email::Folder::POP3::POP3->new($host, "Port", $port, "Timeout", 60) or die "Net::POP3->new('${host}', Port => $port, Timeout => 60): $!" 0 0 0
28 or die("Net::POP3->new('$host', Port => $port, Timeout => 60): $!");
29  
30 0 my ($user, $pass) = @{$self}{qw[username password]};
31 0 ▶ ($user, $pass) = split ':', $uri->userinfo, 2 unless $user;
Branch: 1 branch
BranchTrueFalseTotal
unless $user 0 0 0
32  
33 0 ▶ $server->login($user, $pass) if $user;
Branch: 1 branch
BranchTrueFalseTotal
if $user 0 0 0
34  
35 0 $self->{_next} = 1;
36 0 return $self->{_server} = $server;
37 }
38  
39 0 ▶sub next_message {
Subroutine next_message: not called CC=2 SCAR=17.9
Pod documented
40 0 my $self = shift;
41 0 my $message = $self->_server->get($self->{_next});
42 0 ▶ if ( $message ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($message) 0 0 0
43 0 ++$self->{_next};
44 0 return join '', @{$message};
45 }
46 0 $self->{_next} = 1;
47 0 return;
48 }
49  
50 1 1;
51  
52 __END__
↑ Summary