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
|
|
87195
|
use strict; |
|
28
|
|
|
|
|
108
|
|
|
28
|
|
|
|
|
914
|
|
6
|
28
|
|
|
28
|
|
145
|
use warnings; |
|
28
|
|
|
|
|
52
|
|
|
28
|
|
|
|
|
1747
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20210914'; # VERSION |
8
|
28
|
|
|
28
|
|
204
|
use Scalar::Util qw{ weaken }; |
|
28
|
|
|
|
|
62
|
|
|
28
|
|
|
|
|
1788
|
|
9
|
28
|
|
|
28
|
|
191
|
use Carp; |
|
28
|
|
|
|
|
48
|
|
|
28
|
|
|
|
|
1920
|
|
10
|
|
|
|
|
|
|
|
11
|
28
|
|
|
28
|
|
202
|
use base 'Mail::AuthenticationResults::Header::Base'; |
|
28
|
|
|
|
|
77
|
|
|
28
|
|
|
|
|
18278
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
318
|
|
|
318
|
|
1451
|
sub _HAS_VALUE{ return 1; } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub safe_set_value { |
17
|
7
|
|
|
7
|
1
|
1040
|
my ( $self, $value ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
7
|
50
|
|
|
|
25
|
$value = q{} if ! defined $value; |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
|
|
22
|
$value =~ s/\t/ /g; |
22
|
7
|
|
|
|
|
14
|
$value =~ s/\n/ /g; |
23
|
7
|
|
|
|
|
14
|
$value =~ s/\r/ /g; |
24
|
|
|
|
|
|
|
|
25
|
7
|
|
|
|
|
11
|
my $remain = $value; |
26
|
7
|
|
|
|
|
13
|
my $depth = 0; |
27
|
7
|
|
|
|
|
10
|
my $nested_ok = 1; |
28
|
7
|
|
|
|
|
19
|
while ( length $remain > 0 ) { |
29
|
29
|
|
|
|
|
41
|
my $first = substr( $remain,0,1 ); |
30
|
29
|
|
|
|
|
40
|
$remain = substr( $remain,1 ); |
31
|
29
|
100
|
|
|
|
53
|
$depth++ if $first eq '('; |
32
|
29
|
100
|
|
|
|
42
|
$depth-- if $first eq ')'; |
33
|
29
|
100
|
|
|
|
65
|
$nested_ok = 0 if $depth == -1; |
34
|
|
|
|
|
|
|
} |
35
|
7
|
100
|
|
|
|
17
|
$nested_ok = 0 if $depth != 0; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Remove parens if nested comments would be broken by them. |
38
|
7
|
100
|
|
|
|
15
|
if ( ! $nested_ok ) { |
39
|
5
|
|
|
|
|
20
|
$value =~ s/\(/ /g; |
40
|
5
|
|
|
|
|
15
|
$value =~ s/\)/ /g; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
7
|
|
|
|
|
31
|
$value =~ s/^\s+//; |
44
|
7
|
|
|
|
|
25
|
$value =~ s/\s+$//; |
45
|
|
|
|
|
|
|
#$value =~ s/;/ /g; |
46
|
|
|
|
|
|
|
|
47
|
7
|
|
|
|
|
25
|
$self->set_value( $value ); |
48
|
7
|
|
|
|
|
27
|
return $self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub set_value { |
52
|
81
|
|
|
81
|
1
|
1032
|
my ( $self, $value ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
81
|
|
|
|
|
170
|
my $remain = $value; |
55
|
81
|
|
|
|
|
139
|
my $depth = 0; |
56
|
81
|
|
|
|
|
275
|
while ( length $remain > 0 ) { |
57
|
1502
|
|
|
|
|
1907
|
my $first = substr( $remain,0,1 ); |
58
|
1502
|
|
|
|
|
1944
|
$remain = substr( $remain,1 ); |
59
|
1502
|
100
|
|
|
|
2275
|
$depth++ if $first eq '('; |
60
|
1502
|
100
|
|
|
|
2207
|
$depth-- if $first eq ')'; |
61
|
1502
|
100
|
|
|
|
2871
|
croak 'Out of order parens in comment' if $depth == -1; |
62
|
|
|
|
|
|
|
} |
63
|
78
|
100
|
|
|
|
233
|
croak 'Mismatched parens in comment' if $depth != 0; |
64
|
76
|
50
|
|
|
|
250
|
croak 'Invalid characters in value' if $value =~ /\n/; |
65
|
76
|
50
|
|
|
|
199
|
croak 'Invalid characters in value' if $value =~ /\r/; |
66
|
|
|
|
|
|
|
|
67
|
76
|
|
|
|
|
268
|
$self->{ 'value' } = $value; |
68
|
76
|
|
|
|
|
299
|
return $self; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub build_string { |
72
|
73
|
|
|
73
|
1
|
155
|
my ( $self, $header ) = @_; |
73
|
73
|
|
|
|
|
188
|
$header->comment( '(' . $self->value() . ')' ); |
74
|
73
|
|
|
|
|
159
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |