line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::AuthenticationResults::Token::Comment; |
2
|
|
|
|
|
|
|
# ABSTRACT: Class for modelling AuthenticationResults Header parts detected as comments |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
require 5.008; |
5
|
29
|
|
|
29
|
|
547
|
use strict; |
|
29
|
|
|
|
|
54
|
|
|
29
|
|
|
|
|
847
|
|
6
|
29
|
|
|
29
|
|
139
|
use warnings; |
|
29
|
|
|
|
|
52
|
|
|
29
|
|
|
|
|
1110
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20210915'; # VERSION |
8
|
29
|
|
|
29
|
|
150
|
use Carp; |
|
29
|
|
|
|
|
52
|
|
|
29
|
|
|
|
|
1768
|
|
9
|
|
|
|
|
|
|
|
10
|
29
|
|
|
29
|
|
183
|
use base 'Mail::AuthenticationResults::Token'; |
|
29
|
|
|
|
|
80
|
|
|
29
|
|
|
|
|
10198
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub is { |
14
|
352
|
|
|
352
|
1
|
541
|
my ( $self ) = @_; |
15
|
352
|
|
|
|
|
961
|
return 'comment'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub parse { |
19
|
71
|
|
|
71
|
1
|
140
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
|
21
|
71
|
|
|
|
|
129
|
my $header = $self->{ 'header' }; |
22
|
71
|
|
|
|
|
136
|
my $value = q{}; |
23
|
71
|
|
|
|
|
110
|
my $depth = 0; |
24
|
|
|
|
|
|
|
|
25
|
71
|
|
|
|
|
140
|
my $first = substr( $header,0,1 ); |
26
|
71
|
100
|
|
|
|
345
|
if ( $first ne '(' ) { |
27
|
1
|
|
|
|
|
9
|
croak 'Not a comment'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
70
|
|
|
|
|
257
|
while ( length $header > 0 ) { |
31
|
1618
|
|
|
|
|
2315
|
my $first = substr( $header,0,1 ); |
32
|
1618
|
|
|
|
|
2418
|
$header = substr( $header,1 ); |
33
|
1618
|
|
|
|
|
2100
|
$value .= $first; |
34
|
1618
|
100
|
|
|
|
3568
|
if ( $first eq '(' ) { |
|
|
100
|
|
|
|
|
|
35
|
71
|
|
|
|
|
280
|
$depth++; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif ( $first eq ')' ) { |
38
|
70
|
|
|
|
|
97
|
$depth--; |
39
|
70
|
100
|
|
|
|
185
|
last if $depth == 0; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
70
|
100
|
|
|
|
177
|
if ( $depth != 0 ) { |
44
|
1
|
|
|
|
|
11
|
croak 'Mismatched parens in comment'; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
69
|
|
|
|
|
261
|
$value =~ s/^\(//; |
48
|
69
|
|
|
|
|
247
|
$value =~ s/\)$//; |
49
|
|
|
|
|
|
|
|
50
|
69
|
|
|
|
|
164
|
$self->{ 'value' } = $value; |
51
|
69
|
|
|
|
|
174
|
$self->{ 'header' } = $header; |
52
|
|
|
|
|
|
|
|
53
|
69
|
|
|
|
|
170
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |