| 1 | package Sietima::Message; | ||
| 2 | 19 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 19 | ▶ | use Sietima::Policy; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 19 | ▶ | use Types::Standard qw(ArrayRef Object); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 19 | ▶ | use Sietima::Types qw(Address AddressFromStr |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | Subscriber SubscriberFromAddress SubscriberFromStr | ||
| 7 | 19 | EmailMIME); | |
| 8 | 19 | ▶ | use Email::Address; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 19 | ▶ | use Sietima::Subscriber; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 19 | ▶ | use Email::MIME; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 19 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 19 | our $VERSION = '1.1.5'; # VERSION | |
| 14 | # ABSTRACT: an email message with an envelope | ||
| 15 | |||
| 16 | |||
| 17 | 19 | has mail => ( | |
| 18 | is => 'ro', | ||
| 19 | isa => EmailMIME, | ||
| 20 | required => 1, | ||
| 21 | ); | ||
| 22 | |||
| 23 | |||
| 24 | 19 | has from => ( | |
| 25 | is => 'ro', | ||
| 26 | isa => Address, | ||
| 27 | coerce => AddressFromStr, | ||
| 28 | required => 1, | ||
| 29 | ); | ||
| 30 | |||
| 31 | |||
| 32 | 19 | my $subscriber_array = ArrayRef[ | |
| 33 | Subscriber->plus_coercions( | ||
| 34 | SubscriberFromStr, | ||
| 35 | SubscriberFromAddress, | ||
| 36 | ) | ||
| 37 | ]; | ||
| 38 | 19 | has to => ( | |
| 39 | isa => $subscriber_array, | ||
| 40 | is => 'ro', | ||
| 41 | coerce => $subscriber_array->coercion, | ||
| 42 | required => 1, | ||
| 43 | ); | ||
| 44 | |||
| 45 | |||
| 46 | 41 | ▶ | sub envelope ($self) { |
|
Subroutine
envelope: called CC=1 SCAR=0.0
Pod
documented
| |||
| 47 | return { | ||
| 48 | from => $self->from, | ||
| 49 | 41 | to => [ map { $_->address } $self->to->@* ], | |
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | 19 | 1; | |
| 54 | |||
| 55 | __END__ | ||