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
|
|
77329
|
use strict; |
|
28
|
|
|
|
|
86
|
|
|
28
|
|
|
|
|
903
|
|
6
|
28
|
|
|
28
|
|
148
|
use warnings; |
|
28
|
|
|
|
|
55
|
|
|
28
|
|
|
|
|
1472
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20210914'; # VERSION |
8
|
28
|
|
|
28
|
|
165
|
use Scalar::Util qw{ refaddr }; |
|
28
|
|
|
|
|
59
|
|
|
28
|
|
|
|
|
1323
|
|
9
|
28
|
|
|
28
|
|
167
|
use Carp; |
|
28
|
|
|
|
|
54
|
|
|
28
|
|
|
|
|
1499
|
|
10
|
|
|
|
|
|
|
|
11
|
28
|
|
|
28
|
|
503
|
use base 'Mail::AuthenticationResults::Header::Base'; |
|
28
|
|
|
|
|
57
|
|
|
28
|
|
|
|
|
15299
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
2140
|
|
|
2140
|
|
3941
|
sub _HAS_CHILDREN{ return 1; } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _ALLOWED_CHILDREN { |
17
|
923
|
|
|
923
|
|
1238
|
my ( $self, $child ) = @_; |
18
|
923
|
100
|
|
|
|
1779
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header'; |
19
|
881
|
100
|
|
|
|
1466
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::AuthServID'; |
20
|
877
|
100
|
|
|
|
1439
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Comment'; |
21
|
865
|
100
|
|
|
|
1819
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Entry'; |
22
|
397
|
100
|
|
|
|
864
|
return 1 if ref $child eq 'Mail::AuthenticationResults::Header::Group'; |
23
|
207
|
100
|
|
|
|
522
|
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
|
|
|
|
|
16
|
return 0; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub add_child { |
29
|
557
|
|
|
557
|
1
|
7055
|
my ( $self, $child ) = @_; |
30
|
557
|
100
|
|
|
|
927
|
croak 'Cannot add child' if ! $self->_ALLOWED_CHILDREN( $child ); |
31
|
556
|
100
|
|
|
|
1445
|
croak 'Cannot add a class as its own parent' if refaddr $self == refaddr $child; |
32
|
|
|
|
|
|
|
|
33
|
555
|
100
|
|
|
|
1040
|
if ( ref $child eq 'Mail::AuthenticationResults::Header::Group' ) { |
34
|
189
|
|
|
|
|
260
|
foreach my $subchild ( @{ $child->children() } ) { |
|
189
|
|
|
|
|
407
|
|
35
|
188
|
|
|
|
|
502
|
$self->add_child( $subchild ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
## ToDo what to return in this case? |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
366
|
|
|
|
|
446
|
foreach my $current_child ( @{ $self->children() } ) { |
|
366
|
|
|
|
|
753
|
|
41
|
251
|
100
|
|
|
|
517
|
if ( $current_child == $child ) { |
42
|
6
|
|
|
|
|
21
|
return $child; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
360
|
|
|
|
|
895
|
$self->SUPER::add_child( $child ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
549
|
|
|
|
|
1058
|
return $child; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub build_string { |
52
|
16
|
|
|
16
|
1
|
32
|
my ( $self, $header ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
16
|
|
|
|
|
30
|
my $sep = 0; |
55
|
16
|
|
|
|
|
22
|
foreach my $child ( @{ $self->children() } ) { |
|
16
|
|
|
|
|
35
|
|
56
|
16
|
100
|
|
|
|
40
|
$header->separator( ';' ) if $sep; |
57
|
16
|
100
|
|
|
|
35
|
$header->space( "\n" ) if $sep; |
58
|
16
|
|
|
|
|
22
|
$sep = 1; |
59
|
16
|
|
|
|
|
70
|
$child->build_string( $header ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
16
|
|
|
|
|
38
|
return; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |