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
|
30
|
|
|
30
|
|
599
|
use strict; |
|
30
|
|
|
|
|
66
|
|
|
30
|
|
|
|
|
923
|
|
6
|
30
|
|
|
30
|
|
150
|
use warnings; |
|
30
|
|
|
|
|
51
|
|
|
30
|
|
|
|
|
1126
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20230112'; # VERSION |
8
|
30
|
|
|
30
|
|
171
|
use Carp; |
|
30
|
|
|
|
|
55
|
|
|
30
|
|
|
|
|
2059
|
|
9
|
|
|
|
|
|
|
|
10
|
30
|
|
|
30
|
|
243
|
use base 'Mail::AuthenticationResults::Token'; |
|
30
|
|
|
|
|
87
|
|
|
30
|
|
|
|
|
11447
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub is { |
14
|
390
|
|
|
390
|
1
|
615
|
my ( $self ) = @_; |
15
|
390
|
|
|
|
|
1041
|
return 'comment'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub parse { |
19
|
77
|
|
|
77
|
1
|
190
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
|
21
|
77
|
|
|
|
|
149
|
my $header = $self->{ 'header' }; |
22
|
77
|
|
|
|
|
230
|
my $value = q{}; |
23
|
77
|
|
|
|
|
183
|
my $depth = 0; |
24
|
|
|
|
|
|
|
|
25
|
77
|
|
|
|
|
483
|
my $first = substr( $header,0,1 ); |
26
|
77
|
100
|
|
|
|
519
|
if ( $first ne '(' ) { |
27
|
1
|
|
|
|
|
9
|
croak 'Not a comment'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
76
|
|
|
|
|
629
|
while ( length $header > 0 ) { |
31
|
1720
|
|
|
|
|
2434
|
my $first = substr( $header,0,1 ); |
32
|
1720
|
|
|
|
|
2394
|
$header = substr( $header,1 ); |
33
|
1720
|
|
|
|
|
1949
|
$value .= $first; |
34
|
1720
|
100
|
|
|
|
3639
|
if ( $first eq '(' ) { |
|
|
100
|
|
|
|
|
|
35
|
77
|
|
|
|
|
168
|
$depth++; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif ( $first eq ')' ) { |
38
|
76
|
|
|
|
|
103
|
$depth--; |
39
|
76
|
100
|
|
|
|
237
|
last if $depth == 0; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
76
|
100
|
|
|
|
179
|
if ( $depth != 0 ) { |
44
|
1
|
|
|
|
|
10
|
croak 'Mismatched parens in comment'; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
75
|
|
|
|
|
354
|
$value =~ s/^\(//; |
48
|
75
|
|
|
|
|
293
|
$value =~ s/\)$//; |
49
|
|
|
|
|
|
|
|
50
|
75
|
|
|
|
|
206
|
$self->{ 'value' } = $value; |
51
|
75
|
|
|
|
|
126
|
$self->{ 'header' } = $header; |
52
|
|
|
|
|
|
|
|
53
|
75
|
|
|
|
|
168
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |