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
|
28
|
|
|
28
|
|
69364
|
use strict; |
|
28
|
|
|
|
|
64
|
|
|
28
|
|
|
|
|
875
|
|
6
|
28
|
|
|
28
|
|
143
|
use warnings; |
|
28
|
|
|
|
|
51
|
|
|
28
|
|
|
|
|
1315
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20210915'; # VERSION |
8
|
28
|
|
|
28
|
|
155
|
use Scalar::Util qw{ refaddr }; |
|
28
|
|
|
|
|
53
|
|
|
28
|
|
|
|
|
1249
|
|
9
|
28
|
|
|
28
|
|
150
|
use Carp; |
|
28
|
|
|
|
|
53
|
|
|
28
|
|
|
|
|
1539
|
|
10
|
|
|
|
|
|
|
|
11
|
28
|
|
|
28
|
|
525
|
use base 'Mail::AuthenticationResults::Header::Base'; |
|
28
|
|
|
|
|
64
|
|
|
28
|
|
|
|
|
14037
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
2140
|
|
|
2140
|
|
3950
|
sub _HAS_CHILDREN{ return 1; } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _ALLOWED_CHILDREN { |
17
|
923
|
|
|
923
|
|
1264
|
my ( $self, $child ) = @_; |
18
|
923
|
100
|
|
|
|
1687
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header'; |
19
|
881
|
100
|
|
|
|
1476
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::AuthServID'; |
20
|
877
|
100
|
|
|
|
1371
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Comment'; |
21
|
865
|
100
|
|
|
|
1861
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Entry'; |
22
|
397
|
100
|
|
|
|
814
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Group'; |
23
|
207
|
100
|
|
|
|
534
|
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
|
557
|
|
|
557
|
1
|
6868
|
my ( $self, $child ) = @_; |
30
|
557
|
100
|
|
|
|
913
|
croak 'Cannot add child' if ! $self->_ALLOWED_CHILDREN( $child ); |
31
|
556
|
100
|
|
|
|
1457
|
croak 'Cannot add a class as its own parent' if refaddr $self == refaddr $child; |
32
|
|
|
|
|
|
|
|
33
|
555
|
100
|
|
|
|
966
|
if ( ref $child eq 'Mail::AuthenticationResults::Header::Group' ) { |
34
|
189
|
|
|
|
|
282
|
foreach my $subchild ( @{ $child->children() } ) { |
|
189
|
|
|
|
|
430
|
|
35
|
188
|
|
|
|
|
435
|
$self->add_child( $subchild ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
## ToDo what to return in this case? |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
366
|
|
|
|
|
448
|
foreach my $current_child ( @{ $self->children() } ) { |
|
366
|
|
|
|
|
766
|
|
41
|
251
|
100
|
|
|
|
492
|
if ( $current_child == $child ) { |
42
|
6
|
|
|
|
|
21
|
return $child; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
360
|
|
|
|
|
851
|
$self->SUPER::add_child( $child ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
549
|
|
|
|
|
1022
|
return $child; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub build_string { |
52
|
16
|
|
|
16
|
1
|
32
|
my ( $self, $header ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
16
|
|
|
|
|
25
|
my $sep = 0; |
55
|
16
|
|
|
|
|
26
|
foreach my $child ( @{ $self->children() } ) { |
|
16
|
|
|
|
|
35
|
|
56
|
16
|
100
|
|
|
|
39
|
$header->separator( ';' ) if $sep; |
57
|
16
|
100
|
|
|
|
31
|
$header->space( "\n" ) if $sep; |
58
|
16
|
|
|
|
|
22
|
$sep = 1; |
59
|
16
|
|
|
|
|
42
|
$child->build_string( $header ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
16
|
|
|
|
|
33
|
return; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |