« lib/Mail/DMARC/Report/Aggregate/Record/Row.pm
↑ Summary
lib/Mail/DMARC/Report/Aggregate/Record/Identifiers.pm »
| 1 | package Mail::DMARC::Report::Aggregate::Metadata; | ||||||||||||||||||||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use feature 'signatures'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 11 | ▶ | no warnings 'experimental::args_array_with_signatures'; ## no critic (ProhibitNoWarnings) | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 11 | our $VERSION = '2.20261110'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use XML::LibXML; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 11 | ▶ | use parent 'Mail::DMARC::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 130 | ▶ | sub org_name( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
org_name: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 130 | ▶ | return $self->{org_name} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | 36 | return $self->{org_name} = $value; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 104 | ▶ | sub email( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
email: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 104 | ▶ | return $self->{email} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 36 | return $self->{email} = $value; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 64 | ▶ | sub extra_contact_info( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
extra_contact_info: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 64 | ▶ | return $self->{extra_contact_info} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 28 | return $self->{extra_contact_info} = $value; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 124 | ▶ | sub report_id( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
report_id: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 124 | ▶ | return $self->{report_id} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 32 | return $self->{report_id} = $value; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 2 | ▶ | sub date_range( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
date_range: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 2 | ▶ | return $self->{date_range} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | # croak "invalid date_range" if ('HASH' ne ref $value); | ||||||||||||||||||||||||||||
| 37 | 1 | return $self->{date_range} = $value; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 102 | ▶ | sub begin( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
begin: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 102 | ▶ | return $self->{date_range}{begin} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 39 | return $self->{date_range}{begin} = $value; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 98 | ▶ | sub end( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
end: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 98 | ▶ | return $self->{date_range}{end} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 37 | return $self->{date_range}{end} = $value; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 20 | ▶ | sub error( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
error: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 20 | ▶ | return $self->{error} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 4 | return push @{ $self->{error} }, $value; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 32 | ▶ | sub uuid( $self, $value = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
uuid: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 32 | ▶ | return $self->{uuid} if @_ == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 4 | return $self->{uuid} = $value; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 15 | ▶ | sub as_xml($self) { | ||||||||||||||||||||||||||
|
Subroutine
as_xml: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 61 | 15 | my $meta = "\t<report_metadata>\n"; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 15 | foreach my $f (qw/ org_name email extra_contact_info report_id /) { | |||||||||||||||||||||||||||
| 64 | 60 | ▶ | my $val = $self->$f or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 59 | $val = XML::LibXML::Text->new($val)->toString(); | |||||||||||||||||||||||||||
| 66 | 59 | $meta .= "\t\t<$f>$val</$f>\n"; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 15 | my $begin = XML::LibXML::Text->new( $self->begin )->toString(); | |||||||||||||||||||||||||||
| 69 | 15 | my $end = XML::LibXML::Text->new( $self->end )->toString(); | |||||||||||||||||||||||||||
| 70 | 15 | $meta | |||||||||||||||||||||||||||
| 71 | .= "\t\t<date_range>\n\t\t\t<begin>" | ||||||||||||||||||||||||||||
| 72 | . $begin | ||||||||||||||||||||||||||||
| 73 | . "</begin>\n" | ||||||||||||||||||||||||||||
| 74 | . "\t\t\t<end>" | ||||||||||||||||||||||||||||
| 75 | . $end | ||||||||||||||||||||||||||||
| 76 | . "</end>\n\t\t</date_range>\n"; | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | # the RFC 9990 schema allows one error element | ||||||||||||||||||||||||||||
| 79 | 15 | my $errors = $self->error; | |||||||||||||||||||||||||||
| 80 | 15 | ▶ | if ( $errors && @$errors ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$errors and @$errors
MC/DC50%1/2
$errors and @$errors
$errors
@$errors
Truth table66%2/3
A and B
A= $errorsB= @$errors
| |||||||||||||||||||||||||||||
| 81 | 5 | my $err = XML::LibXML::Text->new( join '; ', @$errors )->toString(); | |||||||||||||||||||||||||||
| 82 | 5 | $meta .= "\t\t<error>$err</error>\n"; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | 15 | $meta .= "\t</report_metadata>"; | |||||||||||||||||||||||||||
| 85 | 15 | return $meta; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 11 | 1; | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | __END__ | ||||||||||||||||||||||||||||