line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::DMARC::Report::Aggregate::Record::Auth_Results::DKIM; |
2
|
|
|
|
|
|
|
our $VERSION = '1.20210927'; |
3
|
13
|
|
|
13
|
|
86
|
use strict; |
|
13
|
|
|
|
|
33
|
|
|
13
|
|
|
|
|
406
|
|
4
|
|
|
|
|
|
|
|
5
|
13
|
|
|
13
|
|
73
|
use Carp; |
|
13
|
|
|
|
|
31
|
|
|
13
|
|
|
|
|
7133
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
55
|
|
|
55
|
0
|
176
|
my ( $class, @args ) = @_; |
9
|
|
|
|
|
|
|
|
10
|
55
|
50
|
|
|
|
171
|
croak "missing arguments" if 0 == scalar @args; |
11
|
|
|
|
|
|
|
|
12
|
55
|
|
|
|
|
135
|
my $self = bless {}, $class; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# a bare hash |
15
|
55
|
100
|
|
|
|
161
|
return $self->_from_hash(@args) if scalar @args > 1; |
16
|
|
|
|
|
|
|
|
17
|
49
|
|
|
|
|
93
|
my $dkim = shift @args; |
18
|
49
|
50
|
|
|
|
167
|
croak "dkim argument not a ref" if ! ref $dkim; |
19
|
|
|
|
|
|
|
|
20
|
49
|
100
|
|
|
|
162
|
return $dkim if ref $dkim eq $class; # been here before... |
21
|
|
|
|
|
|
|
|
22
|
44
|
50
|
|
|
|
248
|
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
|
223
|
return $_[0]->{domain} if 1 == scalar @_; |
29
|
49
|
|
|
|
|
154
|
return $_[0]->{domain} = $_[1]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub selector { |
33
|
44
|
50
|
|
44
|
0
|
123
|
return $_[0]->{selector} if 1 == scalar @_; |
34
|
44
|
|
|
|
|
130
|
return $_[0]->{selector} = $_[1]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub result { |
38
|
49
|
50
|
|
49
|
0
|
126
|
return $_[0]->{result} if 1 == scalar @_; |
39
|
49
|
100
|
|
|
|
105
|
croak "invalid DKIM result" if ! grep { $_ eq $_[1] } |
|
343
|
|
|
|
|
895
|
|
40
|
|
|
|
|
|
|
qw/ pass fail neutral none permerror policy temperror /; |
41
|
48
|
|
|
|
|
133
|
return $_[0]->{result} = $_[1]; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub human_result { |
45
|
36
|
50
|
|
36
|
0
|
96
|
return $_[0]->{human_result} if 1 == scalar @_; |
46
|
36
|
|
|
|
|
91
|
return $_[0]->{human_result} = $_[1]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _from_hash { |
50
|
50
|
|
|
50
|
|
191
|
my ($self, %args) = @_; |
51
|
|
|
|
|
|
|
|
52
|
50
|
|
|
|
|
164
|
foreach my $key ( keys %args ) { |
53
|
179
|
|
|
|
|
478
|
$self->$key( $args{$key} ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
48
|
|
|
|
|
160
|
$self->is_valid; |
57
|
48
|
|
|
|
|
241
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _from_hashref { |
61
|
44
|
|
|
44
|
|
83
|
return $_[0]->_from_hash(%{ $_[1] }); |
|
44
|
|
|
|
|
201
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub is_valid { |
65
|
48
|
|
|
48
|
0
|
80
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
48
|
|
|
|
|
102
|
foreach my $f (qw/ domain result /) { |
68
|
96
|
50
|
|
|
|
298
|
if ( ! defined $self->{$f} ) { |
69
|
0
|
|
|
|
|
0
|
croak "DKIM value $f is required!"; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
48
|
|
|
|
|
100
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |