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
|
28
|
|
|
28
|
|
73930
|
use strict; |
|
28
|
|
|
|
|
102
|
|
|
28
|
|
|
|
|
862
|
|
6
|
28
|
|
|
28
|
|
193
|
use warnings; |
|
28
|
|
|
|
|
49
|
|
|
28
|
|
|
|
|
1242
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20210915'; # VERSION |
8
|
28
|
|
|
28
|
|
196
|
use Scalar::Util qw{ weaken }; |
|
28
|
|
|
|
|
86
|
|
|
28
|
|
|
|
|
1697
|
|
9
|
28
|
|
|
28
|
|
188
|
use Carp; |
|
28
|
|
|
|
|
87
|
|
|
28
|
|
|
|
|
1888
|
|
10
|
|
|
|
|
|
|
|
11
|
28
|
|
|
28
|
|
192
|
use base 'Mail::AuthenticationResults::Header::Base'; |
|
28
|
|
|
|
|
65
|
|
|
28
|
|
|
|
|
16123
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
318
|
|
|
318
|
|
1487
|
sub _HAS_VALUE{ return 1; } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub safe_set_value { |
17
|
7
|
|
|
7
|
1
|
842
|
my ( $self, $value ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
7
|
50
|
|
|
|
18
|
$value = q{} if ! defined $value; |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
|
|
19
|
$value =~ s/\t/ /g; |
22
|
7
|
|
|
|
|
10
|
$value =~ s/\n/ /g; |
23
|
7
|
|
|
|
|
11
|
$value =~ s/\r/ /g; |
24
|
|
|
|
|
|
|
|
25
|
7
|
|
|
|
|
9
|
my $remain = $value; |
26
|
7
|
|
|
|
|
11
|
my $depth = 0; |
27
|
7
|
|
|
|
|
8
|
my $nested_ok = 1; |
28
|
7
|
|
|
|
|
17
|
while ( length $remain > 0 ) { |
29
|
29
|
|
|
|
|
39
|
my $first = substr( $remain,0,1 ); |
30
|
29
|
|
|
|
|
41
|
$remain = substr( $remain,1 ); |
31
|
29
|
100
|
|
|
|
50
|
$depth++ if $first eq '('; |
32
|
29
|
100
|
|
|
|
46
|
$depth-- if $first eq ')'; |
33
|
29
|
100
|
|
|
|
57
|
$nested_ok = 0 if $depth == -1; |
34
|
|
|
|
|
|
|
} |
35
|
7
|
100
|
|
|
|
16
|
$nested_ok = 0 if $depth != 0; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Remove parens if nested comments would be broken by them. |
38
|
7
|
100
|
|
|
|
14
|
if ( ! $nested_ok ) { |
39
|
5
|
|
|
|
|
16
|
$value =~ s/\(/ /g; |
40
|
5
|
|
|
|
|
16
|
$value =~ s/\)/ /g; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
7
|
|
|
|
|
21
|
$value =~ s/^\s+//; |
44
|
7
|
|
|
|
|
20
|
$value =~ s/\s+$//; |
45
|
|
|
|
|
|
|
#$value =~ s/;/ /g; |
46
|
|
|
|
|
|
|
|
47
|
7
|
|
|
|
|
19
|
$self->set_value( $value ); |
48
|
7
|
|
|
|
|
26
|
return $self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub set_value { |
52
|
81
|
|
|
81
|
1
|
1080
|
my ( $self, $value ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
81
|
|
|
|
|
141
|
my $remain = $value; |
55
|
81
|
|
|
|
|
131
|
my $depth = 0; |
56
|
81
|
|
|
|
|
236
|
while ( length $remain > 0 ) { |
57
|
1502
|
|
|
|
|
1902
|
my $first = substr( $remain,0,1 ); |
58
|
1502
|
|
|
|
|
1877
|
$remain = substr( $remain,1 ); |
59
|
1502
|
100
|
|
|
|
2220
|
$depth++ if $first eq '('; |
60
|
1502
|
100
|
|
|
|
2240
|
$depth-- if $first eq ')'; |
61
|
1502
|
100
|
|
|
|
2790
|
croak 'Out of order parens in comment' if $depth == -1; |
62
|
|
|
|
|
|
|
} |
63
|
78
|
100
|
|
|
|
178
|
croak 'Mismatched parens in comment' if $depth != 0; |
64
|
76
|
50
|
|
|
|
259
|
croak 'Invalid characters in value' if $value =~ /\n/; |
65
|
76
|
50
|
|
|
|
170
|
croak 'Invalid characters in value' if $value =~ /\r/; |
66
|
|
|
|
|
|
|
|
67
|
76
|
|
|
|
|
209
|
$self->{ 'value' } = $value; |
68
|
76
|
|
|
|
|
321
|
return $self; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub build_string { |
72
|
73
|
|
|
73
|
1
|
150
|
my ( $self, $header ) = @_; |
73
|
73
|
|
|
|
|
221
|
$header->comment( '(' . $self->value() . ')' ); |
74
|
73
|
|
|
|
|
170
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |