Sietima/Role/SubscriberOnly.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 100% 51 / 51 CC 3 SCAR 4.1
CC
3
Cov
100%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Sietima/CmdLine.pm ↑ Summary Sietima.pm »
1 package Sietima::Role::SubscriberOnly;
2 3 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use Sietima::Policy;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Email::Address;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use List::AllUtils qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Types::Standard qw(Object CodeRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Type::Params -sigs;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 our $VERSION = '1.1.5'; # VERSION
11 # ABSTRACT: base role for "closed" lists
12  
13  
14 3 requires 'munge_mail_from_non_subscriber';
15  
16 3 our $let_it_pass=0; ## no critic(ProhibitPackageVars)
17  
18  
19 10 ▶around munge_mail => sub ($orig,$self,$mail) {
Subroutine __ANON__: called CC=3 SCAR=11.0
20 10 my ($from) = Email::Address->parse( $mail->header_str('from') );
21 10 ▶ if ( $let_it_pass or
Branch: 1 branch
BranchTrueFalseTotal
if ($Sietima::Role::SubscriberOnly::let_it_pass or &any(sub { $_->match($from); } , @{$self->subscribers})) { } 5 5 10
Condition100%3/3
$Sietima::Role::SubscriberOnly::let_it_pass or &any(sub { $_->match($from); } , @{$self->subscribers})
l!l&&r!l&&!r
235
MC/DC100%2/2
$Sietima::Role::SubscriberOnly::let_it_pass or &any(sub { $_->match($from); } , @{$self->subscribers})
$Sietima::Role::SubscriberOnly::let_it_pass &any(sub { $_->match($from); } , @{$self->subscribers})
Truth table100%3/3
A or B
A= $Sietima::Role::SubscriberOnly::let_it_passB= &any(sub { $_->match($from); } , @{$self->subscribers})
ABresult
1X1
011
000
22 14 ▶ any { $_->match($from) } $self->subscribers->@* ) {
Subroutine __ANON__: called CC=1 SCAR=0.0
23 5 $self->$orig($mail);
24 }
25 else {
26 5 $self->munge_mail_from_non_subscriber($mail);
27 }
28 3 };
29  
30  
31 2 signature_for ignoring_subscriberonly => (
32 method => Object,
33 positional => [ CodeRef ],
34 );
35 3 ▶sub ignoring_subscriberonly($self,$code) {
Subroutine ignoring_subscriberonly: called CC=1 SCAR=0.0
36 4 local $let_it_pass = 1;
37 4 return $code->($self);
38 }
39  
40 2 1;
41  
42 __END__
« Sietima/CmdLine.pm ↑ Summary Sietima.pm »