diff options
author | dakkar <dakkar@thenautilus.net> | 2019-04-29 15:32:06 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2019-04-29 15:32:06 +0100 |
commit | 790cd95fafc32c16a7c984cd5492ba4b752a6ff2 (patch) | |
tree | a503b91ecf2f063af0e03e792dc227ccb9f2e2e6 /lib/Sietima/Role/NoMail.pm | |
parent | v1.0.4 (diff) | |
download | Sietima-543e65d0195c4096a26bc84b23acb522007201b0.tar.gz Sietima-543e65d0195c4096a26bc84b23acb522007201b0.tar.bz2 Sietima-543e65d0195c4096a26bc84b23acb522007201b0.zip |
Dzil-build release 1.0.4 (from 402b4b8 on master)v1.0.4
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..adcc5ad 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.4'; # 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.4 + =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 |