line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::DMARC::Report::Aggregate::Record::Auth_Results::DKIM; |
2
|
|
|
|
|
|
|
our $VERSION = '1.20211209'; |
3
|
13
|
|
|
13
|
|
101
|
use strict; |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
460
|
|
4
|
|
|
|
|
|
|
|
5
|
13
|
|
|
13
|
|
71
|
use Carp; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
7452
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
55
|
|
|
55
|
0
|
202
|
my ( $class, @args ) = @_; |
9
|
|
|
|
|
|
|
|
10
|
55
|
50
|
|
|
|
213
|
croak "missing arguments" if 0 == scalar @args; |
11
|
|
|
|
|
|
|
|
12
|
55
|
|
|
|
|
153
|
my $self = bless {}, $class; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# a bare hash |
15
|
55
|
100
|
|
|
|
179
|
return $self->_from_hash(@args) if scalar @args > 1; |
16
|
|
|
|
|
|
|
|
17
|
49
|
|
|
|
|
109
|
my $dkim = shift @args; |
18
|
49
|
50
|
|
|
|
217
|
croak "dkim argument not a ref" if ! ref $dkim; |
19
|
|
|
|
|
|
|
|
20
|
49
|
100
|
|
|
|
190
|
return $dkim if ref $dkim eq $class; # been here before... |
21
|
|
|
|
|
|
|
|
22
|
44
|
50
|
|
|
|
237
|
return $self->_from_hashref($dkim) if 'HASH' eq ref $dkim; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
0
|
croak "invalid dkim argument"; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub domain { |
28
|
49
|
50
|
|
49
|
0
|
207
|
return $_[0]->{domain} if 1 == scalar @_; |
29
|
49
|
|
|
|
|
166
|
return $_[0]->{domain} = $_[1]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub selector { |
33
|
44
|
50
|
|
44
|
0
|
134
|
return $_[0]->{selector} if 1 == scalar @_; |
34
|
44
|
|
|
|
|
124
|
return $_[0]->{selector} = $_[1]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub result { |
38
|
49
|
50
|
|
49
|
0
|
147
|
return $_[0]->{result} if 1 == scalar @_; |
39
|
49
|
100
|
|
|
|
134
|
croak "invalid DKIM result" if ! grep { $_ eq $_[1] } |
|
343
|
|
|
|
|
936
|
|
40
|
|
|
|
|
|
|
qw/ pass fail neutral none permerror policy temperror /; |
41
|
48
|
|
|
|
|
186
|
return $_[0]->{result} = $_[1]; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub human_result { |
45
|
36
|
50
|
|
36
|
0
|
94
|
return $_[0]->{human_result} if 1 == scalar @_; |
46
|
36
|
|
|
|
|
105
|
return $_[0]->{human_result} = $_[1]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _from_hash { |
50
|
50
|
|
|
50
|
|
231
|
my ($self, %args) = @_; |
51
|
|
|
|
|
|
|
|
52
|
50
|
|
|
|
|
171
|
foreach my $key ( keys %args ) { |
53
|
179
|
|
|
|
|
531
|
$self->$key( $args{$key} ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
48
|
|
|
|
|
198
|
$self->is_valid; |
57
|
48
|
|
|
|
|
241
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _from_hashref { |
61
|
44
|
|
|
44
|
|
99
|
return $_[0]->_from_hash(%{ $_[1] }); |
|
44
|
|
|
|
|
238
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub is_valid { |
65
|
48
|
|
|
48
|
0
|
82
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
48
|
|
|
|
|
133
|
foreach my $f (qw/ domain result /) { |
68
|
96
|
50
|
|
|
|
909
|
if ( ! defined $self->{$f} ) { |
69
|
0
|
|
|
|
|
0
|
croak "DKIM value $f is required!"; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
48
|
|
|
|
|
92
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |