line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::AuthenticationResults::Header::Group; |
2
|
|
|
|
|
|
|
# ABSTRACT: Class modelling Groups of Authentication Results Header parts |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
require 5.008; |
5
|
29
|
|
|
29
|
|
76411
|
use strict; |
|
29
|
|
|
|
|
67
|
|
|
29
|
|
|
|
|
896
|
|
6
|
29
|
|
|
29
|
|
154
|
use warnings; |
|
29
|
|
|
|
|
71
|
|
|
29
|
|
|
|
|
1302
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20230112'; # VERSION |
8
|
29
|
|
|
29
|
|
183
|
use Scalar::Util qw{ refaddr }; |
|
29
|
|
|
|
|
62
|
|
|
29
|
|
|
|
|
1332
|
|
9
|
29
|
|
|
29
|
|
165
|
use Carp; |
|
29
|
|
|
|
|
59
|
|
|
29
|
|
|
|
|
1575
|
|
10
|
|
|
|
|
|
|
|
11
|
29
|
|
|
29
|
|
603
|
use base 'Mail::AuthenticationResults::Header::Base'; |
|
29
|
|
|
|
|
73
|
|
|
29
|
|
|
|
|
15346
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
2269
|
|
|
2269
|
|
4270
|
sub _HAS_CHILDREN{ return 1; } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _ALLOWED_CHILDREN { |
17
|
983
|
|
|
983
|
|
1360
|
my ( $self, $child ) = @_; |
18
|
983
|
100
|
|
|
|
1804
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header'; |
19
|
941
|
100
|
|
|
|
1519
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::AuthServID'; |
20
|
937
|
100
|
|
|
|
1550
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Comment'; |
21
|
925
|
100
|
|
|
|
1900
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Entry'; |
22
|
409
|
100
|
|
|
|
897
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Group'; |
23
|
207
|
100
|
|
|
|
530
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::SubEntry'; |
24
|
5
|
100
|
|
|
|
15
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Version'; |
25
|
1
|
|
|
|
|
13
|
return 0; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub add_child { |
29
|
593
|
|
|
593
|
1
|
6259
|
my ( $self, $child ) = @_; |
30
|
593
|
100
|
|
|
|
967
|
croak 'Cannot add child' if ! $self->_ALLOWED_CHILDREN( $child ); |
31
|
592
|
100
|
|
|
|
1552
|
croak 'Cannot add a class as its own parent' if refaddr $self == refaddr $child; |
32
|
|
|
|
|
|
|
|
33
|
591
|
100
|
|
|
|
1038
|
if ( ref $child eq 'Mail::AuthenticationResults::Header::Group' ) { |
34
|
201
|
|
|
|
|
266
|
foreach my $subchild ( @{ $child->children() } ) { |
|
201
|
|
|
|
|
408
|
|
35
|
200
|
|
|
|
|
405
|
$self->add_child( $subchild ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
## ToDo what to return in this case? |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
390
|
|
|
|
|
486
|
foreach my $current_child ( @{ $self->children() } ) { |
|
390
|
|
|
|
|
795
|
|
41
|
282
|
100
|
|
|
|
542
|
if ( $current_child == $child ) { |
42
|
6
|
|
|
|
|
21
|
return $child; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
384
|
|
|
|
|
925
|
$self->SUPER::add_child( $child ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
585
|
|
|
|
|
1062
|
return $child; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub build_string { |
52
|
18
|
|
|
18
|
1
|
41
|
my ( $self, $header ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
18
|
|
|
|
|
29
|
my $sep = 0; |
55
|
18
|
|
|
|
|
27
|
foreach my $child ( @{ $self->children() } ) { |
|
18
|
|
|
|
|
41
|
|
56
|
20
|
100
|
|
|
|
65
|
$header->separator( ';' ) if $sep; |
57
|
20
|
100
|
|
|
|
46
|
$header->space( "\n" ) if $sep; |
58
|
20
|
|
|
|
|
28
|
$sep = 1; |
59
|
20
|
|
|
|
|
57
|
$child->build_string( $header ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
18
|
|
|
|
|
34
|
return; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |