lib/Mail/DMARC/Report/Aggregate/Metadata.pm

filter: Statementstmt 100% 63 / 63 Branchbran 100% 22 / 22 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 16 / 16 Podpod 0.0% 0 / 10 totaltotal 89.6% 104 / 116 CC 24 SCAR 11.5
CC
24
Cov
99%
as_xml
6.0
org_name
3.0
email
3.0
CRAP 3.2
« lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm ↑ Summary lib/Mail/DMARC/Report/Aggregate/Record/Row.pm »
1 package Mail::DMARC::Report::Aggregate::Metadata;
2 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶no warnings 'experimental::args_array_with_signatures'; ## no critic (ProhibitNoWarnings)
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 our $VERSION = '2.20260827';
8  
9 10 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 10 ▶use parent 'Mail::DMARC::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 123 ▶sub org_name( $self, $value = undef ) {
Subroutine org_name: called CC=3 SCAR=11.0
Pod undocumented
14 123 ▶ return $self->{org_name} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 89 34 123
15 34 return $self->{org_name} = $value;
16 }
17  
18 98 ▶sub email( $self, $value = undef ) {
Subroutine email: called CC=3 SCAR=11.0
Pod undocumented
19 98 ▶ return $self->{email} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 64 34 98
20 34 return $self->{email} = $value;
21 }
22  
23 60 ▶sub extra_contact_info( $self, $value = undef ) {
Subroutine extra_contact_info: called CC=3 SCAR=11.0
Pod undocumented
24 60 ▶ return $self->{extra_contact_info} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 34 26 60
25 26 return $self->{extra_contact_info} = $value;
26 }
27  
28 119 ▶sub report_id( $self, $value = undef ) {
Subroutine report_id: called CC=3 SCAR=11.0
Pod undocumented
29 119 ▶ return $self->{report_id} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 90 29 119
30 29 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
BranchTrueFalseTotal
if @_ == 1 1 1 2
35  
36 # croak "invalid date_range" if ('HASH' ne ref $value);
37 1 return $self->{date_range} = $value;
38 }
39  
40 97 ▶sub begin( $self, $value = undef ) {
Subroutine begin: called CC=3 SCAR=11.0
Pod undocumented
41 97 ▶ return $self->{date_range}{begin} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 60 37 97
42 37 return $self->{date_range}{begin} = $value;
43 }
44  
45 93 ▶sub end( $self, $value = undef ) {
Subroutine end: called CC=3 SCAR=11.0
Pod undocumented
46 93 ▶ return $self->{date_range}{end} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 58 35 93
47 35 return $self->{date_range}{end} = $value;
48 }
49  
50 18 ▶sub error( $self, $value = undef ) {
Subroutine error: called CC=3 SCAR=11.0
Pod undocumented
51 18 ▶ return $self->{error} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 15 3 18
52 3 return push @{ $self->{error} }, $value;
53 }
54  
55 31 ▶sub uuid( $self, $value = undef ) {
Subroutine uuid: called CC=3 SCAR=11.0
Pod undocumented
56 31 ▶ return $self->{uuid} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 27 4 31
57 4 return $self->{uuid} = $value;
58 }
59  
60 14 ▶sub as_xml($self) {
Subroutine as_xml: called CC=6 SCAR=17.9
Pod undocumented
61 14 my $meta = "\t<report_metadata>\n";
62  
63 14 foreach my $f (qw/ org_name email extra_contact_info report_id /) {
64 56 ▶ my $val = $self->$f or next;
Branch: 1 branch
BranchTrueFalseTotal
my $val = $self->$f or next 55 1 56
65 55 $val = XML::LibXML::Text->new($val)->toString();
66 55 $meta .= "\t\t<$f>$val</$f>\n";
67 }
68 14 my $begin = XML::LibXML::Text->new( $self->begin )->toString();
69 14 my $end = XML::LibXML::Text->new( $self->end )->toString();
70 14 $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 14 my $errors = $self->error;
79 14 ▶ if ( $errors && @$errors ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($errors and @$errors) 4 10 14
Condition66%2/3
$errors and @$errors
!ll&&!rl&&r
1004
MC/DC50%1/2
$errors and @$errors
$errors @$errors
Truth table66%2/3
A and B
A= $errorsB= @$errors
ABresult
0X0
100
111
80 4 foreach my $err (@$errors) {
81 5 $err = XML::LibXML::Text->new($err)->toString();
82 5 $meta .= "\t\t<error>$err</error>\n";
83 }
84 }
85 14 $meta .= "\t</report_metadata>";
86 14 return $meta;
87 }
88  
89 10 1;
90  
91 __END__
92  
93 =pod
94  
95 =head1 NAME
96  
97 Mail::DMARC::Report::Aggregate::Metadata - metadata section of aggregate report
98  
99 =head1 VERSION
100  
101 version 2.20260827
102  
103 =head1 AUTHORS
104  
105 =over 4
106  
107 =item *
108  
109 Matt Simerson <msimerson@cpan.org>
110  
111 =item *
112  
113 Davide Migliavacca <shari@cpan.org>
114  
115 =item *
116  
117 Marc Bradshaw <marc@marcbradshaw.net>
118  
119 =back
120  
121 =head1 COPYRIGHT AND LICENSE
122  
123 This software is copyright (c) 2026 by Matt Simerson.
124  
125 This is free software; you can redistribute it and/or modify it under
126 the same terms as the Perl 5 programming language system itself.
127  
128 =cut
« lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm ↑ Summary lib/Mail/DMARC/Report/Aggregate/Record/Row.pm »