« blib/lib/Email/Sender/Transport/Wrapper.pm
↑ Summary
blib/lib/Email/Sender/Transport/Failable.pm »
| 1 | package Email::Sender::Failure 2.603; | ||||||||||
| 2 | # ABSTRACT: a report of failure from an email sending transport | ||||||||||
| 3 | |||||||||||
| 4 | 17 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 17 | extends 'Throwable::Error'; | |||||||||
| 6 | |||||||||||
| 7 | 17 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 17 | ▶ | use MooX::Types::MooseLike::Base qw(ArrayRef); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | #pod =attr message | ||||||||||
| 11 | #pod | ||||||||||
| 12 | #pod This method returns the failure message, which should describe the failure. | ||||||||||
| 13 | #pod Failures stringify to this message. | ||||||||||
| 14 | #pod | ||||||||||
| 15 | #pod =attr code | ||||||||||
| 16 | #pod | ||||||||||
| 17 | #pod This returns the numeric code of the failure, if any. This is mostly useful | ||||||||||
| 18 | #pod for network protocol transports like SMTP. This may be undefined. | ||||||||||
| 19 | #pod | ||||||||||
| 20 | #pod =cut | ||||||||||
| 21 | |||||||||||
| 22 | 17 | has code => ( | |||||||||
| 23 | is => 'ro', | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | #pod =attr recipients | ||||||||||
| 27 | #pod | ||||||||||
| 28 | #pod This returns a list of addresses to which the email could not be sent. | ||||||||||
| 29 | #pod | ||||||||||
| 30 | #pod =cut | ||||||||||
| 31 | |||||||||||
| 32 | has recipients => ( | ||||||||||
| 33 | isa => ArrayRef, | ||||||||||
| 34 | 46 | ▶ | default => sub { [] }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 35 | 17 | writer => '_set_recipients', | |||||||||
| 36 | reader => '__get_recipients', | ||||||||||
| 37 | is => 'rw', | ||||||||||
| 38 | accessor => undef, | ||||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | 14 | ▶ | sub __recipients { @{$_[0]->__get_recipients} } | ||||||||
|
Subroutine
__recipients: called CC=1 SCAR=0.0
| |||||||||||
| 42 | |||||||||||
| 43 | 14 | ▶ | sub recipients { | ||||||||
|
Subroutine
recipients: called CC=3 SCAR=17.3
Pod
documented
| |||||||||||
| 44 | 14 | my ($self) = @_; | |||||||||
| 45 | 14 | ▶ | return $self->__recipients if wantarray; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 0 | ▶ | return if ! defined wantarray; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | |||||||||||
| 48 | 0 | Carp::carp("recipients in scalar context is deprecated and WILL BE REMOVED"); | |||||||||
| 49 | 0 | return $self->__get_recipients; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | #pod =method throw | ||||||||||
| 53 | #pod | ||||||||||
| 54 | #pod This method can be used to instantiate and throw an Email::Sender::Failure | ||||||||||
| 55 | #pod object at once. | ||||||||||
| 56 | #pod | ||||||||||
| 57 | #pod Email::Sender::Failure->throw(\%arg); | ||||||||||
| 58 | #pod | ||||||||||
| 59 | #pod Instead of a hashref of args, you can pass a single string argument which will | ||||||||||
| 60 | #pod be used as the C<message> of the new failure. | ||||||||||
| 61 | #pod | ||||||||||
| 62 | #pod =cut | ||||||||||
| 63 | |||||||||||
| 64 | 51 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 65 | 51 | my ($self) = @_; | |||||||||
| 66 | 51 | ▶ | Carp::confess("message must contain non-space characters") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | unless $self->message =~ /\S/; | ||||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | #pod =head1 SEE ALSO | ||||||||||
| 71 | #pod | ||||||||||
| 72 | #pod =over | ||||||||||
| 73 | #pod | ||||||||||
| 74 | #pod =item * L<Email::Sender::Permanent> | ||||||||||
| 75 | #pod | ||||||||||
| 76 | #pod =item * L<Email::Sender::Temporary> | ||||||||||
| 77 | #pod | ||||||||||
| 78 | #pod =item * L<Email::Sender::Multi> | ||||||||||
| 79 | #pod | ||||||||||
| 80 | #pod =back | ||||||||||
| 81 | #pod | ||||||||||
| 82 | #pod =cut | ||||||||||
| 83 | |||||||||||
| 84 | 17 | ▶ | no Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 85 | 17 | 1; | |||||||||
| 86 | |||||||||||
| 87 | __END__ | ||||||||||