| 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
Condition100%3/3
$Sietima::Role::SubscriberOnly::let_it_pass or &any(sub {
$_->match($from);
}
, @{$self->subscribers})
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})
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||