| 1 | package Sietima::Subscriber; | ||
| 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 HashRef Object); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 19 | ▶ | use Type::Params -sigs; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 19 | ▶ | use Sietima::Types qw(Address AddressFromStr); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 19 | ▶ | use Email::Address; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 19 | ▶ | use List::AllUtils qw(any); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 19 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 15 | our $VERSION = '1.1.5'; # VERSION | |
| 12 | # ABSTRACT: a subscriber to a mailing list | ||
| 13 | |||
| 14 | |||
| 15 | 15 | has primary => ( | |
| 16 | isa => Address, | ||
| 17 | is => 'ro', | ||
| 18 | required => 1, | ||
| 19 | coerce => AddressFromStr, | ||
| 20 | handles => [qw(address name original)], | ||
| 21 | ); | ||
| 22 | |||
| 23 | |||
| 24 | 15 | my $address_array = ArrayRef[ | |
| 25 | Address->plus_coercions( | ||
| 26 | AddressFromStr | ||
| 27 | ) | ||
| 28 | ]; | ||
| 29 | 15 | has aliases => ( | |
| 30 | isa => $address_array, | ||
| 31 | is => 'lazy', | ||
| 32 | coerce => $address_array->coercion, | ||
| 33 | ); | ||
| 34 | 7 | ▶ | sub _build_aliases { +[] } |
|
Subroutine
_build_aliases: called CC=1 SCAR=0.0
| |||
| 35 | |||
| 36 | |||
| 37 | has prefs => ( | ||
| 38 | isa => HashRef, | ||
| 39 | is => 'ro', | ||
| 40 | 47 | ▶ | default => sub { +{} }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 41 | 15 | ); | |
| 42 | |||
| 43 | |||
| 44 | 15 | signature_for match => ( | |
| 45 | method => Object, | ||
| 46 | positional => [ Address->plus_coercions(AddressFromStr) ], | ||
| 47 | ); | ||
| 48 | 17 | ▶ | sub match($self,$addr) { |
|
Subroutine
match: called CC=1 SCAR=0.0
| |||
| 49 | 22 | ▶ | return any { $addr->address eq $_->address } |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 50 | 17 | $self->primary, $self->aliases->@*; | |
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | 15 | 1; | |
| 55 | |||
| 56 | __END__ | ||