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
|
|
586
|
use strict; |
|
29
|
|
|
|
|
58
|
|
|
29
|
|
|
|
|
855
|
|
6
|
29
|
|
|
29
|
|
142
|
use warnings; |
|
29
|
|
|
|
|
63
|
|
|
29
|
|
|
|
|
1079
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20210914'; # VERSION |
8
|
29
|
|
|
29
|
|
186
|
use Carp; |
|
29
|
|
|
|
|
54
|
|
|
29
|
|
|
|
|
1543
|
|
9
|
|
|
|
|
|
|
|
10
|
29
|
|
|
29
|
|
164
|
use base 'Mail::AuthenticationResults::Token'; |
|
29
|
|
|
|
|
56
|
|
|
29
|
|
|
|
|
11191
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub is { |
14
|
352
|
|
|
352
|
1
|
556
|
my ( $self ) = @_; |
15
|
352
|
|
|
|
|
1070
|
return 'comment'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub parse { |
19
|
71
|
|
|
71
|
1
|
144
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
|
21
|
71
|
|
|
|
|
137
|
my $header = $self->{ 'header' }; |
22
|
71
|
|
|
|
|
127
|
my $value = q{}; |
23
|
71
|
|
|
|
|
107
|
my $depth = 0; |
24
|
|
|
|
|
|
|
|
25
|
71
|
|
|
|
|
140
|
my $first = substr( $header,0,1 ); |
26
|
71
|
100
|
|
|
|
302
|
if ( $first ne '(' ) { |
27
|
1
|
|
|
|
|
9
|
croak 'Not a comment'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
70
|
|
|
|
|
236
|
while ( length $header > 0 ) { |
31
|
1618
|
|
|
|
|
2324
|
my $first = substr( $header,0,1 ); |
32
|
1618
|
|
|
|
|
2439
|
$header = substr( $header,1 ); |
33
|
1618
|
|
|
|
|
2234
|
$value .= $first; |
34
|
1618
|
100
|
|
|
|
3976
|
if ( $first eq '(' ) { |
|
|
100
|
|
|
|
|
|
35
|
71
|
|
|
|
|
290
|
$depth++; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif ( $first eq ')' ) { |
38
|
70
|
|
|
|
|
102
|
$depth--; |
39
|
70
|
100
|
|
|
|
200
|
last if $depth == 0; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
70
|
100
|
|
|
|
168
|
if ( $depth != 0 ) { |
44
|
1
|
|
|
|
|
11
|
croak 'Mismatched parens in comment'; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
69
|
|
|
|
|
275
|
$value =~ s/^\(//; |
48
|
69
|
|
|
|
|
258
|
$value =~ s/\)$//; |
49
|
|
|
|
|
|
|
|
50
|
69
|
|
|
|
|
165
|
$self->{ 'value' } = $value; |
51
|
69
|
|
|
|
|
180
|
$self->{ 'header' } = $header; |
52
|
|
|
|
|
|
|
|
53
|
69
|
|
|
|
|
150
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |