| 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
| |||||||||||
| 25 | 0 | $header_from_address = $header_from->address; | |||||||||
| 26 | return | ||||||||||
| 27 | 0 | ▶ | if match_address( $self->allowed_addresses, $header_from_address ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | } | ||||||||||
| 29 | 0 | $self->reject( $self->reject_text, $header_from_address ); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 1 | 1; | |||||||||
| 33 | |||||||||||
| 34 | __END__ | ||||||||||