| 1 | package Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated; | ||
| 2 | our $VERSION = '2.20260827'; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use feature 'signatures'; | ||
| 6 | no warnings 'experimental::args_array_with_signatures'; ## no critic (ProhibitNoWarnings) | ||
| 7 | |||
| 8 | use Carp; | ||
| 9 | |||
| 10 | sub new( $class, @args ) { | ||
| 11 | croak "invalid arguments" if @args % 2; | ||
| 12 | my %args = @args; | ||
| 13 | my $self = bless { reason => [] }, $class; | ||
| 14 | foreach my $key ( keys %args ) { | ||
| 15 | $self->$key( $args{$key} ); | ||
| 16 | } | ||
| 17 | return $self; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub disposition( $self, $value = undef ) { | ||
| 21 | return $self->{disposition} if @_ == 1; | ||
| 22 | croak 'invalid disposition: ' . ( $value // '(undef)' ) | ||
| 23 | if !defined $value || 0 == grep {/^$value$/ix} qw/ reject quarantine none /; | ||
| 24 | return $self->{disposition} = $value; | ||
| 25 | } | ||
| 26 | |||
| 27 | sub dkim( $self, $value = undef ) { | ||
| 28 | return $self->{dkim} if @_ == 1; | ||
| 29 | return $self->{dkim} = $value; | ||
| 30 | } | ||
| 31 | |||
| 32 | sub spf( $self, $value = undef ) { | ||
| 33 | return $self->{spf} if @_ == 1; | ||
| 34 | return $self->{spf} = $value; | ||
| 35 | } | ||
| 36 | |||
| 37 | sub reason( $self, $value = undef ) { | ||
| 38 | return $self->{reason} if @_ == 1; | ||
| 39 | if ( 'ARRAY' eq ref $value ) { # one shot argument | ||
| 40 | $self->{reason} = $value; | ||
| 41 | } | ||
| 42 | else { | ||
| 43 | push @{ $self->{reason} }, $value; | ||
| 44 | } | ||
| 45 | return $self->{reason}; | ||
| 46 | } | ||
| 47 | |||
| 48 | 1; | ||
| 49 | |||
| 50 | __END__ | ||
| 51 | |||
| 52 | =pod | ||
| 53 | |||
| 54 | =head1 NAME | ||
| 55 | |||
| 56 | Mail::DMARC::Report::Aggregate::Record::Row::Policy_Evaluated - row/policy_evaluated section of a DMARC aggregate record | ||
| 57 | |||
| 58 | =head1 VERSION | ||
| 59 | |||
| 60 | version 2.20260827 | ||
| 61 | |||
| 62 | =head1 AUTHORS | ||
| 63 | |||
| 64 | =over 4 | ||
| 65 | |||
| 66 | =item * | ||
| 67 | |||
| 68 | Matt Simerson <msimerson@cpan.org> | ||
| 69 | |||
| 70 | =item * | ||
| 71 | |||
| 72 | Davide Migliavacca <shari@cpan.org> | ||
| 73 | |||
| 74 | =item * | ||
| 75 | |||
| 76 | Marc Bradshaw <marc@marcbradshaw.net> | ||
| 77 | |||
| 78 | =back | ||
| 79 | |||
| 80 | =head1 COPYRIGHT AND LICENSE | ||
| 81 | |||
| 82 | This software is copyright (c) 2026 by Matt Simerson. | ||
| 83 | |||
| 84 | This is free software; you can redistribute it and/or modify it under | ||
| 85 | the same terms as the Perl 5 programming language system itself. | ||
| 86 | |||
| 87 | =cut |