File Coverage

lib/Mail/DMARC/Report/Aggregate/Record/Row.pm
Criterion Covered Total %
statement 28 28 100.0
branch 10 14 71.4
condition n/a
subroutine 7 7 100.0
pod 0 4 0.0
total 45 53 84.9


line stmt bran cond sub pod time code
1             package Mail::DMARC::Report::Aggregate::Record::Row;
2             our $VERSION = '1.20230215';
3 12     12   86 use strict;
  12         24  
  12         376  
4 12     12   69 use warnings;
  12         30  
  12         304  
5              
6 12     12   64 use Carp;
  12         40  
  12         4509  
7             require Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated;
8              
9             sub new {
10 16     16 0 60 my ( $class, @args ) = @_;
11 16 50       76 croak "invalid arguments" if @args % 2;
12 16         51 my %args = @args;
13 16         50 my $self = bless {}, $class;
14 16         58 foreach my $key ( keys %args ) {
15 28         117 $self->$key( $args{$key} );
16             }
17 16         98 return $self;
18             }
19              
20             sub source_ip {
21 22 100   22 0 898 return $_[0]->{source_ip} if 1 == scalar @_;
22 16         100 return $_[0]->{source_ip} = $_[1];
23             }
24              
25             sub policy_evaluated {
26 43     43 0 823 my ($self, @args) = @_;
27              
28 43 100       136 if (0 == scalar @args) {
29 27 50       246 return $self->{policy_evaluated} if $self->{policy_evaluated};
30             }
31              
32 16 100       62 if (1 == scalar @args) {
33 11 50       55 if ('HASH' eq ref $args[0]) {
34 11         22 @args = %{ $args[0] };
  11         49  
35             }
36             }
37              
38             return $self->{policy_evaluated} =
39 16         175 Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated->new(@args);
40             }
41              
42             sub count {
43 9 50   9 0 763 return $_[0]->{count} if 1 == scalar @_;
44 9         30 return $_[0]->{count} = $_[1];
45             }
46              
47             1;
48              
49             __END__