File: Row.pm

package info (click to toggle)
libmail-dmarc-perl 1.20211209-4
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 1,724 kB
  • sloc: perl: 4,937; xml: 13; makefile: 10; sh: 1
file content (87 lines) | stat: -rw-r--r-- 1,599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package Mail::DMARC::Report::Aggregate::Record::Row;
our $VERSION = '1.20211209';
use strict;
use warnings;

use Carp;
require Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated;

sub new {
    my ( $class, @args ) = @_;
    croak "invalid arguments" if @args % 2;
    my %args = @args;
    my $self = bless {}, $class;
    foreach my $key ( keys %args ) {
        $self->$key( $args{$key} );
    }
    return $self;
}

sub source_ip {
    return $_[0]->{source_ip} if 1 == scalar @_;
    return $_[0]->{source_ip} =  $_[1];
}

sub policy_evaluated {
    my ($self, @args) = @_;

    if (0 == scalar @args) {
        return $self->{policy_evaluated} if $self->{policy_evaluated};
    }

    if (1 == scalar @args) {
        if ('HASH' eq ref $args[0]) {
            @args = %{ $args[0] };
        }        
    }

    return $self->{policy_evaluated} =
        Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated->new(@args);
}

sub count {
    return $_[0]->{count} if 1 == scalar @_;
    return $_[0]->{count} =  $_[1];
}

1;

__END__

=pod

=head1 NAME

Mail::DMARC::Report::Aggregate::Record::Row - row section of a DMARC aggregate record

=head1 VERSION

version 1.20211209

=head1 AUTHORS

=over 4

=item *

Matt Simerson <msimerson@cpan.org>

=item *

Davide Migliavacca <shari@cpan.org>

=item *

Marc Bradshaw <marc@marcbradshaw.net>

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Matt Simerson.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut