diff options
author | dakkar <dakkar@thenautilus.net> | 2019-04-29 15:44:40 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2019-04-29 15:44:40 +0100 |
commit | 308c885f76632b56d4841968fe4a8287710be8ce (patch) | |
tree | 96df34b4e4959e839415e2c635111d669ccaf1b7 /lib/Sietima/Role/NoMail.pm | |
parent | v1.0.5 (diff) | |
parent | Dzil-build release 1.0.4 (from 402b4b8 on master) (diff) | |
download | Sietima-308c885f76632b56d4841968fe4a8287710be8ce.tar.gz Sietima-308c885f76632b56d4841968fe4a8287710be8ce.tar.bz2 Sietima-308c885f76632b56d4841968fe4a8287710be8ce.zip |
Dzil-build release 1.0.5 (from ad3b210 on master)v1.0.5
Diffstat (limited to 'lib/Sietima/Role/NoMail.pm')
-rw-r--r-- | lib/Sietima/Role/NoMail.pm | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/lib/Sietima/Role/NoMail.pm b/lib/Sietima/Role/NoMail.pm index 10071d6..6d46a3d 100644 --- a/lib/Sietima/Role/NoMail.pm +++ b/lib/Sietima/Role/NoMail.pm @@ -3,9 +3,33 @@ use Moo::Role; use Sietima::Policy; use namespace::clean; -# VERSION +our $VERSION = '1.0.5'; # VERSION # ABSTRACT: don't send mail to those who don't want it + +around subscribers_to_send_to => sub ($orig,$self,$mail) { + return [ + grep { $_->prefs->{wants_mail} // 1 } + $self->$orig($mail)->@*, + ]; +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Sietima::Role::NoMail - don't send mail to those who don't want it + +=head1 VERSION + +version 1.0.5 + =head1 SYNOPSIS my $sietima = Sietima->with_traits('NoMail')->new({ @@ -22,18 +46,22 @@ A L<< C<Sietima> >> list with this role applied will not send messages to subscribers that have the C<wants_mail> preference set to a false value. -=modif C<subscribers_to_send_to> +=head1 MODIFIED METHODS + +=head2 C<subscribers_to_send_to> Filters out subscribers that have the C<wants_mail> preference set to a false value. -=cut +=head1 AUTHOR -around subscribers_to_send_to => sub ($orig,$self,$mail) { - return [ - grep { $_->prefs->{wants_mail} // 1 } - $self->$orig($mail)->@*, - ]; -}; +Gianni Ceccarelli <dakkar@thenautilus.net> -1; +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2017 by Gianni Ceccarelli <dakkar@thenautilus.net>. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut |