| 1 | package Mail::DMARC::Report::Aggregate::Record::Auth_Results::DKIM; | ||||||||||
| 2 | 17 | our $VERSION = '2.20260827'; | |||||||||
| 3 | 17 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 17 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 17 | ▶ | use feature 'signatures'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 17 | ▶ | no warnings 'experimental::args_array_with_signatures'; ## no critic (ProhibitNoWarnings) | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 17 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 88 | ▶ | sub new( $class, @args ) { | ||||||||
|
Subroutine
new: called CC=6 SCAR=18.6
Pod
undocumented
| |||||||||||
| 11 | |||||||||||
| 12 | 88 | ▶ | croak "missing arguments" if !@args; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | |||||||||||
| 14 | 88 | my $self = bless {}, $class; | |||||||||
| 15 | |||||||||||
| 16 | # a bare hash | ||||||||||
| 17 | 88 | ▶ | return $self->_from_hash(@args) if @args > 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | |||||||||||
| 19 | 81 | my $dkim = shift @args; | |||||||||
| 20 | 81 | ▶ | croak "dkim argument not a ref" if !ref $dkim; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 81 | ▶ | return $dkim if ref $dkim eq $class; # been here before... | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | |||||||||||
| 24 | 70 | ▶ | return $self->_from_hashref($dkim) if 'HASH' eq ref $dkim; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | 0 | croak "invalid dkim argument"; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 76 | ▶ | sub domain( $self, $value = undef ) { | ||||||||
|
Subroutine
domain: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 30 | 76 | ▶ | return $self->{domain} if @_ == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 76 | return $self->{domain} = $value; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 68 | ▶ | sub selector( $self, $value = undef ) { | ||||||||
|
Subroutine
selector: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 35 | 68 | ▶ | return $self->{selector} if @_ == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 68 | return $self->{selector} = $value; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 76 | ▶ | sub result( $self, $value = undef ) { | ||||||||
|
Subroutine
result: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 40 | 76 | ▶ | return $self->{result} if @_ == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | croak "invalid DKIM result" | ||||||||||
| 42 | 76 | ▶ | if !grep { $_ eq $value } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | qw/ pass fail neutral none permerror policy temperror /; | ||||||||||
| 44 | 75 | return $self->{result} = $value; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 55 | ▶ | sub human_result( $self, $value = undef ) { | ||||||||
|
Subroutine
human_result: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 48 | 55 | ▶ | return $self->{human_result} if @_ == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 53 | return $self->{human_result} = $value; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 77 | ▶ | sub _from_hash( $self, %args ) { | ||||||||
|
Subroutine
_from_hash: called CC=2 SCAR=6.9
| |||||||||||
| 53 | |||||||||||
| 54 | 76 | foreach my $key ( keys %args ) { | |||||||||
| 55 | 271 | $self->$key( $args{$key} ); | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 75 | $self->is_valid; | |||||||||
| 59 | 75 | return $self; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 70 | ▶ | sub _from_hashref( $self, $dkim ) { | ||||||||
|
Subroutine
_from_hashref: called CC=1 SCAR=0.0
| |||||||||||
| 63 | 70 | return $self->_from_hash( %{$dkim} ); | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 75 | ▶ | sub is_valid($self) { | ||||||||
|
Subroutine
is_valid: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||
| 67 | |||||||||||
| 68 | 75 | foreach my $f (qw/ domain result /) { | |||||||||
| 69 | 150 | ▶ | if ( !defined $self->{$f} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | croak "DKIM value $f is required!"; | |||||||||
| 71 | } | ||||||||||
| 72 | } | ||||||||||
| 73 | 75 | return; | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 17 | 1; | |||||||||
| 77 | |||||||||||
| 78 | __END__ | ||||||||||
| 79 | |||||||||||
| 80 | =pod | ||||||||||
| 81 | |||||||||||
| 82 | =head1 NAME | ||||||||||
| 83 | |||||||||||
| 84 | Mail::DMARC::Report::Aggregate::Record::Auth_Results::DKIM - auth_results/dkim section of a DMARC aggregate record | ||||||||||
| 85 | |||||||||||
| 86 | =head1 VERSION | ||||||||||
| 87 | |||||||||||
| 88 | version 2.20260827 | ||||||||||
| 89 | |||||||||||
| 90 | =head1 AUTHORS | ||||||||||
| 91 | |||||||||||
| 92 | =over 4 | ||||||||||
| 93 | |||||||||||
| 94 | =item * | ||||||||||
| 95 | |||||||||||
| 96 | Matt Simerson <msimerson@cpan.org> | ||||||||||
| 97 | |||||||||||
| 98 | =item * | ||||||||||
| 99 | |||||||||||
| 100 | Davide Migliavacca <shari@cpan.org> | ||||||||||
| 101 | |||||||||||
| 102 | =item * | ||||||||||
| 103 | |||||||||||
| 104 | Marc Bradshaw <marc@marcbradshaw.net> | ||||||||||
| 105 | |||||||||||
| 106 | =back | ||||||||||
| 107 | |||||||||||
| 108 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 109 | |||||||||||
| 110 | This software is copyright (c) 2026 by Matt Simerson. | ||||||||||
| 111 | |||||||||||
| 112 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 113 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 114 | |||||||||||
| 115 | =cut | ||||||||||