aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2017-02-05 13:29:42 +0000
committerdakkar <dakkar@thenautilus.net>2017-02-05 13:29:42 +0000
commitdcbf392ecd8e22ad4d3d326b83d89d749ca88481 (patch)
treec35b9a2f1b13c939dd7de7023a0650f45365170c /lib
parentPOD for ::Types (diff)
downloadSietima-dcbf392ecd8e22ad4d3d326b83d89d749ca88481.tar.gz
Sietima-dcbf392ecd8e22ad4d3d326b83d89d749ca88481.tar.bz2
Sietima-dcbf392ecd8e22ad4d3d326b83d89d749ca88481.zip
::Subscriber 'raw_address' is now 'primary'
It was a horrible name. The coercion from hashref is also simplified this way.
Diffstat (limited to 'lib')
-rw-r--r--lib/Sietima/Subscriber.pm10
-rw-r--r--lib/Sietima/Types.pm6
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Sietima/Subscriber.pm b/lib/Sietima/Subscriber.pm
index 649b2e5..96c7d3b 100644
--- a/lib/Sietima/Subscriber.pm
+++ b/lib/Sietima/Subscriber.pm
@@ -21,7 +21,7 @@ subscriber, together with possible aliases and preferences.
All attributes are read-only.
-=head2 C<raw_address>
+=head2 C<primary>
Required L<< C<Email::Address> >> object, coercible from a string.
@@ -30,7 +30,7 @@ will receive messages from the mailing list.
=cut
-has raw_address => (
+has primary => (
isa => Address,
is => 'ro',
required => 1,
@@ -83,7 +83,7 @@ has prefs => (
Given a L<< C<Email::Address> >> object (or a string), this method
returns true if the address is equivalent to the
-L<primary|/raw_address> or any of the L</aliases>.
+L</primary> or any of the L</aliases>.
This method should be used to determine whether an address belongs to
a subscriber.
@@ -97,7 +97,7 @@ sub match {
my ($self,$addr) = $check->(@_);
return any { $addr->address eq $_->address }
- $self->raw_address, $self->aliases->@*;
+ $self->primary, $self->aliases->@*;
}
=head2 C<address>
@@ -107,7 +107,7 @@ sub match {
=head2 C<original>
These methods delegate to L<< C<Email::Address> >>'s methods of the
-same name, invoked on the L<primary address|/raw_address>.
+same name, invoked on the L<primary address|/primary>.
=cut
diff --git a/lib/Sietima/Types.pm b/lib/Sietima/Types.pm
index 3288972..1c75b1f 100644
--- a/lib/Sietima/Types.pm
+++ b/lib/Sietima/Types.pm
@@ -165,14 +165,14 @@ class_type Subscriber, { class => 'Sietima::Subscriber' };
declare_coercion SubscriberFromAddress,
to_type Subscriber, from Address,
- q{ Sietima::Subscriber->new(raw_address=>$_) };
+ q{ Sietima::Subscriber->new(primary=>$_) };
declare_coercion SubscriberFromStr,
to_type Subscriber, from Str,
- q{ Sietima::Subscriber->new(raw_address=>(Email::Address->parse($_))[0]) };
+ q{ Sietima::Subscriber->new(primary=>(Email::Address->parse($_))[0]) };
declare_coercion SubscriberFromHashRef,
to_type Subscriber, from HashRef,
- q{ my $a = delete $_->{address};Sietima::Subscriber->new({raw_address => $a, $_->%* }) };
+ q{ Sietima::Subscriber->new($_) };
1;