| 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
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | return if ! defined wantarray; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | return if ! defined wantarray; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition100%3/3
$class eq "Email::Sender::Failure::Permanent" or $class eq "Email::Sender::Failure::Temporary"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||