diff options
author | dakkar <dakkar@thenautilus.net> | 2017-06-21 22:53:17 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2017-06-21 22:53:17 +0100 |
commit | 009f4b10bb5258109f3e80890174ede55cd13f69 (patch) | |
tree | 4fe83bb578817b65c844e9042b205c114c71f8c1 /lib/Sietima/Role/NoMail.pm | |
parent | v1.0.2 (diff) | |
parent | Dzil-build release 1.0.1 (from 5ab528e on master) (diff) | |
download | Sietima-a24ea220376fd0aec8743630ed276f6071615719.tar.gz Sietima-a24ea220376fd0aec8743630ed276f6071615719.tar.bz2 Sietima-a24ea220376fd0aec8743630ed276f6071615719.zip |
Dzil-build release 1.0.2 (from 1e638d0 on master)v1.0.2
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..20e7e5c 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.2'; # 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.2 + =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 |