| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mail::AuthenticationResults::Header::Comment; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Class modelling Comment parts of the Authentication Results Header |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
require 5.008; |
|
5
|
30
|
|
|
30
|
|
116615
|
use strict; |
|
|
30
|
|
|
|
|
80
|
|
|
|
30
|
|
|
|
|
1134
|
|
|
6
|
30
|
|
|
30
|
|
131
|
use warnings; |
|
|
30
|
|
|
|
|
68
|
|
|
|
30
|
|
|
|
|
2193
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20260216'; # VERSION |
|
8
|
30
|
|
|
30
|
|
163
|
use Scalar::Util qw{ weaken }; |
|
|
30
|
|
|
|
|
42
|
|
|
|
30
|
|
|
|
|
1742
|
|
|
9
|
30
|
|
|
30
|
|
170
|
use Carp; |
|
|
30
|
|
|
|
|
56
|
|
|
|
30
|
|
|
|
|
1841
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
30
|
|
|
30
|
|
183
|
use base 'Mail::AuthenticationResults::Header::Base'; |
|
|
30
|
|
|
|
|
46
|
|
|
|
30
|
|
|
|
|
21632
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
360
|
|
|
360
|
|
1832
|
sub _HAS_VALUE{ return 1; } |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub safe_set_value { |
|
17
|
15
|
|
|
15
|
1
|
1290
|
my ( $self, $value ) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
15
|
50
|
|
|
|
76
|
$value = q{} if ! defined $value; |
|
20
|
|
|
|
|
|
|
|
|
21
|
15
|
|
|
|
|
45
|
$value =~ s/\t/ /g; |
|
22
|
15
|
|
|
|
|
31
|
$value =~ s/\n/ /g; |
|
23
|
15
|
|
|
|
|
30
|
$value =~ s/\r/ /g; |
|
24
|
|
|
|
|
|
|
|
|
25
|
15
|
|
|
|
|
27
|
my $remain = $value; |
|
26
|
15
|
|
|
|
|
59
|
my $depth = 0; |
|
27
|
15
|
|
|
|
|
57
|
my $nested_ok = 1; |
|
28
|
15
|
|
|
|
|
66
|
while ( length $remain > 0 ) { |
|
29
|
153
|
|
|
|
|
239
|
my $first = substr( $remain,0,1 ); |
|
30
|
153
|
|
|
|
|
254
|
$remain = substr( $remain,1 ); |
|
31
|
153
|
100
|
|
|
|
275
|
$depth++ if $first eq '('; |
|
32
|
153
|
100
|
|
|
|
298
|
$depth-- if $first eq ')'; |
|
33
|
153
|
100
|
|
|
|
384
|
$nested_ok = 0 if $depth == -1; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
15
|
100
|
|
|
|
41
|
$nested_ok = 0 if $depth != 0; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Remove parens if nested comments would be broken by them. |
|
38
|
15
|
100
|
|
|
|
70
|
if ( ! $nested_ok ) { |
|
39
|
5
|
|
|
|
|
33
|
$value =~ s/\(/ /g; |
|
40
|
5
|
|
|
|
|
19
|
$value =~ s/\)/ /g; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
15
|
|
|
|
|
66
|
$value =~ s/^\s+//; |
|
44
|
15
|
|
|
|
|
58
|
$value =~ s/\s+$//; |
|
45
|
|
|
|
|
|
|
#$value =~ s/;/ /g; |
|
46
|
|
|
|
|
|
|
|
|
47
|
15
|
|
|
|
|
139
|
$self->set_value( $value ); |
|
48
|
15
|
|
|
|
|
66
|
return $self; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub set_value { |
|
52
|
95
|
|
|
95
|
1
|
1395
|
my ( $self, $value ) = @_; |
|
53
|
|
|
|
|
|
|
|
|
54
|
95
|
|
|
|
|
172
|
my $remain = $value; |
|
55
|
95
|
|
|
|
|
151
|
my $depth = 0; |
|
56
|
95
|
|
|
|
|
340
|
while ( length $remain > 0 ) { |
|
57
|
1716
|
|
|
|
|
2943
|
my $first = substr( $remain,0,1 ); |
|
58
|
1716
|
|
|
|
|
2676
|
$remain = substr( $remain,1 ); |
|
59
|
1716
|
100
|
|
|
|
3394
|
$depth++ if $first eq '('; |
|
60
|
1716
|
100
|
|
|
|
3171
|
$depth-- if $first eq ')'; |
|
61
|
1716
|
100
|
|
|
|
4119
|
croak 'Out of order parens in comment' if $depth == -1; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
92
|
100
|
|
|
|
283
|
croak 'Mismatched parens in comment' if $depth != 0; |
|
64
|
90
|
50
|
|
|
|
374
|
croak 'Invalid characters in value' if $value =~ /\n/; |
|
65
|
90
|
50
|
|
|
|
282
|
croak 'Invalid characters in value' if $value =~ /\r/; |
|
66
|
|
|
|
|
|
|
|
|
67
|
90
|
|
|
|
|
382
|
$self->{ 'value' } = $value; |
|
68
|
90
|
|
|
|
|
504
|
return $self; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub build_string { |
|
72
|
91
|
|
|
91
|
1
|
170
|
my ( $self, $header ) = @_; |
|
73
|
91
|
|
|
|
|
348
|
$header->comment( '(' . $self->value() . ')' ); |
|
74
|
91
|
|
|
|
|
284
|
return; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |