Mail/Qmail/Filter/RequireFrom.pm

filter: Statementstmt 71.4% 20 / 28 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 1 / 1 totaltotal 63.4% 26 / 41 CC 3 SCAR 14.9
CC
3
Cov
62%
filter
12.0
__ANON__
2.0
__ANON__
1.3
CRAP 4.4
« Mail/Qmail/Filter/ValidateFrom.pm ↑ Summary Mail/Qmail/Filter/Queue.pm »
1 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Mail::Qmail::Filter::RequireFrom;
5  
6 1 our $VERSION = '1.1';
7  
8 1 ▶use Mail::Qmail::Filter::Util qw(addresses_to_hash match_address);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Mo qw(coerce default required);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 extends 'Mail::Qmail::Filter';
14  
15 1 has 'allowed_addresses' => coerce => \&addresses_to_hash, required => 1;
16 1 has 'lowercase_from'; # ignored; only for backwards compatibility
17 0 ▶has 'reject_text' => sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
18 0 ▶ sub { "<$_[0]> not allowed as RFC5322.From" }
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 0 };
20  
21 0 ▶sub filter {
Subroutine filter: not called CC=3 SCAR=24.8
Pod documented
22 0 my $self = shift;
23 0 my $header_from_address = '';
24 0 ▶ if ( my $header_from = $self->message->header_from ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $header_from = $self->message->header_from) 0 0 0
25 0 $header_from_address = $header_from->address;
26 return
27 0 ▶ if match_address( $self->allowed_addresses, $header_from_address );
Branch: 1 branch
BranchTrueFalseTotal
if match_address($self->allowed_addresses, $header_from_address) 0 0 0
28 }
29 0 $self->reject( $self->reject_text, $header_from_address );
30 }
31  
32 1 1;
33  
34 __END__
« Mail/Qmail/Filter/ValidateFrom.pm ↑ Summary Mail/Qmail/Filter/Queue.pm »