| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Email::Sender::Failure::Multi 2.500; | 
| 2 |  |  |  |  |  |  | # ABSTRACT: an aggregate of multiple failures | 
| 3 |  |  |  |  |  |  |  | 
| 4 | 6 |  |  | 6 |  | 498 | use Moo; | 
|  | 6 |  |  |  |  | 13 |  | 
|  | 6 |  |  |  |  | 34 |  | 
| 5 |  |  |  |  |  |  | extends 'Email::Sender::Failure'; | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 6 |  |  | 6 |  | 2596 | use MooX::Types::MooseLike::Base qw(ArrayRef); | 
|  | 6 |  |  |  |  | 6970 |  | 
|  | 6 |  |  |  |  | 2340 |  | 
| 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 |  |  |  |  |  |  | has failures => ( | 
| 22 |  |  |  |  |  |  | is       => 'ro', | 
| 23 |  |  |  |  |  |  | isa      => ArrayRef, | 
| 24 |  |  |  |  |  |  | required => 1, | 
| 25 |  |  |  |  |  |  | reader   => '__get_failures', | 
| 26 |  |  |  |  |  |  | ); | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 9 |  |  | 9 |  | 14 | sub __failures { @{$_[0]->__get_failures} } | 
|  | 9 |  |  |  |  | 38 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub failures { | 
| 31 | 9 |  |  | 9 | 1 | 878 | my ($self) = @_; | 
| 32 | 9 | 50 |  |  |  | 35 | return $self->__failures if wantarray; | 
| 33 | 0 | 0 |  |  |  | 0 | return if ! defined wantarray; | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 0 |  |  |  |  | 0 | Carp::carp("failures in scalar context is deprecated and WILL BE REMOVED"); | 
| 36 | 0 |  |  |  |  | 0 | return $self->__get_failures; | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub recipients { | 
| 40 | 3 |  |  | 3 | 1 | 1461 | my ($self) = @_; | 
| 41 | 3 |  |  |  |  | 12 | my @rcpts = map { $_->recipients } $self->failures; | 
|  | 3 |  |  |  |  | 12 |  | 
| 42 |  |  |  |  |  |  |  | 
| 43 | 3 | 50 |  |  |  | 20 | return @rcpts if wantarray; | 
| 44 | 0 | 0 |  |  |  | 0 | return if ! defined wantarray; | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 0 |  |  |  |  | 0 | Carp::carp("recipients in scalar context is deprecated and WILL BE REMOVED"); | 
| 47 | 0 |  |  |  |  | 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 |  |  |  |  |  |  | sub isa { | 
| 58 | 29 |  |  | 29 | 1 | 8768 | my ($self, $class) = @_; | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 29 | 100 | 100 |  |  | 180 | if ( | 
| 61 |  |  |  |  |  |  | $class eq 'Email::Sender::Failure::Permanent' | 
| 62 |  |  |  |  |  |  | or | 
| 63 |  |  |  |  |  |  | $class eq 'Email::Sender::Failure::Temporary' | 
| 64 |  |  |  |  |  |  | ) { | 
| 65 | 4 |  |  |  |  | 13 | my @failures = $self->failures; | 
| 66 | 4 | 100 |  |  |  | 11 | return 1 if @failures == grep { $_->isa($class) } @failures; | 
|  | 6 |  |  |  |  | 49 |  | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 | 26 |  |  |  |  | 166 | return $self->SUPER::isa($class); | 
| 70 |  |  |  |  |  |  | } | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 6 |  |  | 6 |  | 48 | no Moo; | 
|  | 6 |  |  |  |  | 12 |  | 
|  | 6 |  |  |  |  | 44 |  | 
| 73 |  |  |  |  |  |  | 1; | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | __END__ |