Sietima/Role/AvoidDups.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 26 / 26 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Sietima/Policy.pm ↑ Summary Sietima/Role/SubscriberOnly/Drop.pm »
1 package Sietima::Role::AvoidDups;
2 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Sietima::Policy;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Email::Address;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '1.1.5'; # VERSION
8 # ABSTRACT: prevent people from receiving the same message multiple times
9  
10  
11 2 ▶around subscribers_to_send_to => sub ($orig,$self,$mail) {
Subroutine __ANON__: called CC=1 SCAR=0.0
12 my @already_receiving = map {
13 2 Email::Address->parse($_)
14 } $mail->header_str('to'),$mail->header_str('cc');
15  
16 my %already_receiving = map {
17 2 $_->address => 1
18 } @already_receiving;
19  
20 return [
21 grep {
22 2 not $already_receiving{$_->address}
23 }
24 $self->$orig($mail)->@*,
25 ];
26 1 };
27  
28 1 1;
29  
30 __END__
« Sietima/Policy.pm ↑ Summary Sietima/Role/SubscriberOnly/Drop.pm »