| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Mail::DMARC::Report::Aggregate::Record; | 
| 2 |  |  |  |  |  |  | our $VERSION = '1.20210927'; | 
| 3 | 12 |  |  | 12 |  | 1659 | use strict; | 
|  | 12 |  |  |  |  | 25 |  | 
|  | 12 |  |  |  |  | 409 |  | 
| 4 | 12 |  |  | 12 |  | 66 | use warnings; | 
|  | 12 |  |  |  |  | 24 |  | 
|  | 12 |  |  |  |  | 367 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 12 |  |  | 12 |  | 70 | use Carp; | 
|  | 12 |  |  |  |  | 27 |  | 
|  | 12 |  |  |  |  | 1218 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 12 |  |  | 12 |  | 912 | use parent 'Mail::DMARC::Base'; | 
|  | 12 |  |  |  |  | 663 |  | 
|  | 12 |  |  |  |  | 81 |  | 
| 9 |  |  |  |  |  |  | require Mail::DMARC::Report::Aggregate::Record::Identifiers; | 
| 10 |  |  |  |  |  |  | require Mail::DMARC::Report::Aggregate::Record::Auth_Results; | 
| 11 |  |  |  |  |  |  | require Mail::DMARC::Report::Aggregate::Record::Row; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub new { | 
| 14 | 16 |  |  | 16 | 0 | 3602 | my ( $class, @args ) = @_; | 
| 15 | 16 | 50 |  |  |  | 68 | croak "invalid arguments" if @args % 2; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 16 |  |  |  |  | 48 | my $self = bless {}, $class; | 
| 18 | 16 | 100 |  |  |  | 69 | return $self if 0 == scalar @args; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 9 |  |  |  |  | 41 | my %args = @args; | 
| 21 | 9 |  |  |  |  | 31 | foreach my $key ( keys %args ) { | 
| 22 | 27 |  |  |  |  | 117 | $self->$key( $args{$key} ); | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 9 |  |  |  |  | 36 | return $self; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub identifiers { | 
| 29 | 53 |  |  | 53 | 0 | 673 | my ($self, @args) = @_; | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 53 | 100 |  |  |  | 186 | if ( !scalar @args ) { | 
| 32 | 37 | 100 |  |  |  | 297 | return $self->{identifiers} if $self->{identifiers}; | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 17 | 100 |  |  |  | 75 | if ('HASH' eq ref $args[0]) { | 
| 36 | 9 |  |  |  |  | 24 | @args = %{ $args[0] }; | 
|  | 9 |  |  |  |  | 41 |  | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | return $self->{identifiers} = | 
| 40 | 17 |  |  |  |  | 154 | Mail::DMARC::Report::Aggregate::Record::Identifiers->new(@args); | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub auth_results { | 
| 44 | 31 |  |  | 31 | 0 | 407 | my ($self, @args) = @_; | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 31 | 100 |  |  |  | 130 | if ( !scalar @args ) { | 
| 47 | 22 | 100 |  |  |  | 169 | return $self->{auth_results} if $self->{auth_results}; | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  |  | 
| 50 | 15 | 100 | 66 |  |  | 94 | if ( 1 == scalar @args && 'HASH' eq ref $args[0] ) { | 
| 51 | 9 |  |  |  |  | 19 | @args = %{ $args[0] }; | 
|  | 9 |  |  |  |  | 129 |  | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | return $self->{auth_results} = | 
| 55 | 15 |  |  |  |  | 168 | Mail::DMARC::Report::Aggregate::Record::Auth_Results->new(@args); | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | sub row { | 
| 59 | 54 |  |  | 54 | 0 | 1937 | my ($self, @args) = @_; | 
| 60 |  |  |  |  |  |  |  | 
| 61 | 54 | 100 |  |  |  | 181 | if ( 0 == scalar @args ) { | 
| 62 | 44 | 100 |  |  |  | 264 | return $self->{row} if $self->{row}; | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 | 16 | 100 | 66 |  |  | 95 | if ( 1 == scalar @args && 'HASH' eq ref $args[0] ) { | 
| 66 | 9 |  |  |  |  | 17 | @args = %{ $args[0] }; | 
|  | 9 |  |  |  |  | 45 |  | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | return $self->{row} = | 
| 70 | 16 |  |  |  |  | 144 | Mail::DMARC::Report::Aggregate::Record::Row->new(@args); | 
| 71 |  |  |  |  |  |  | } | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | 1; | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | __END__ |