blib/lib/Email/Sender/Failure/Multi.pm

filter: Statementstmt 81.2% 26 / 32 Branchbran 50.0% 6 / 12 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 79.6% 47 / 59 CC 8 SCAR 12.8
CC
8
Cov
74%
failures
5.7
recipients
4.5
isa
4.0
CRAP 3.6
« blib/lib/Email/Sender/Transport/Mbox.pm ↑ Summary blib/lib/Email/Sender/Transport/Sendmail.pm »
1 package Email::Sender::Failure::Multi 2.603;
2 # ABSTRACT: an aggregate of multiple failures
3  
4 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 extends 'Email::Sender::Failure';
6  
7 6 ▶use MooX::Types::MooseLike::Base qw(ArrayRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 #pod =head1 DESCRIPTION
10 #pod
11 #pod A multiple failure report is raised when more than one failure is encountered
12 #pod when sending a single message, or when mixed states were encountered.
13 #pod
14 #pod =attr failures
15 #pod
16 #pod This method returns a list of other Email::Sender::Failure objects represented
17 #pod by this multi.
18 #pod
19 #pod =cut
20  
21 6 has failures => (
22 is => 'ro',
23 isa => ArrayRef,
24 required => 1,
25 reader => '__get_failures',
26 );
27  
28 9 ▶sub __failures { @{$_[0]->__get_failures} }
Subroutine __failures: called CC=1 SCAR=0.0
29  
30 9 ▶sub failures {
Subroutine failures: called CC=3 SCAR=17.3
Pod documented
31 9 my ($self) = @_;
32 9 ▶ return $self->__failures if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 9 0 9
33 0 ▶ return if ! defined wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless defined wantarray 0 0 0
34  
35 0 Carp::carp("failures in scalar context is deprecated and WILL BE REMOVED");
36 0 return $self->__get_failures;
37 }
38  
39 3 ▶sub recipients {
Subroutine recipients: called CC=3 SCAR=15.0
Pod documented
40 3 my ($self) = @_;
41 3 my @rcpts = map { $_->recipients } $self->failures;
42  
43 3 ▶ return @rcpts if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 3 0 3
44 0 ▶ return if ! defined wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless defined wantarray 0 0 0
45  
46 0 Carp::carp("recipients in scalar context is deprecated and WILL BE REMOVED");
47 0 return \@rcpts;
48 }
49  
50 #pod =method isa
51 #pod
52 #pod A multiple failure will report that it is a Permanent or Temporary if all of
53 #pod its contained failures are failures of that type.
54 #pod
55 #pod =cut
56  
57 29 ▶sub isa {
Subroutine isa: called CC=4 SCAR=13.9
Pod documented
58 29 my ($self, $class) = @_;
59  
60 29 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($class eq "Email::Sender::Failure::Permanent" or $class eq "Email::Sender::Failure::Temporary") 4 25 29
Condition100%3/3
$class eq "Email::Sender::Failure::Permanent" or $class eq "Email::Sender::Failure::Temporary"
l!l&&r!l&&!r
2225
MC/DC100%2/2
$class eq "Email::Sender::Failure::Permanent" or $class eq "Email::Sender::Failure::Temporary"
$class eq "Email::Sender::Failure::Permanent" $class eq "Email::Sender::Failure::Temporary"
Truth table100%3/3
A or B
A= $class eq "Email::Sender::Failure::Permanent"B= $class eq "Email::Sender::Failure::Temporary"
ABresult
1X1
011
000
61 $class eq 'Email::Sender::Failure::Permanent'
62 or
63 $class eq 'Email::Sender::Failure::Temporary'
64 ) {
65 4 my @failures = $self->failures;
66 4 ▶ return 1 if @failures == grep { $_->isa($class) } @failures;
Branch: 1 branch
BranchTrueFalseTotal
if @failures == grep({$_->isa($class);} @failures) 3 1 4
67 }
68  
69 26 return $self->SUPER::isa($class);
70 }
71  
72 6 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
73 6 1;
74  
75 __END__
« blib/lib/Email/Sender/Transport/Mbox.pm ↑ Summary blib/lib/Email/Sender/Transport/Sendmail.pm »