line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::AuthenticationResults::Token::String; |
2
|
|
|
|
|
|
|
# ABSTRACT: Class for modelling AuthenticationResults Header parts detected as strings |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
require 5.008; |
5
|
29
|
|
|
29
|
|
588
|
use strict; |
|
29
|
|
|
|
|
57
|
|
|
29
|
|
|
|
|
850
|
|
6
|
29
|
|
|
29
|
|
138
|
use warnings; |
|
29
|
|
|
|
|
57
|
|
|
29
|
|
|
|
|
1102
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20210914'; # VERSION |
8
|
29
|
|
|
29
|
|
158
|
use Carp; |
|
29
|
|
|
|
|
75
|
|
|
29
|
|
|
|
|
1665
|
|
9
|
|
|
|
|
|
|
|
10
|
29
|
|
|
29
|
|
174
|
use base 'Mail::AuthenticationResults::Token'; |
|
29
|
|
|
|
|
66
|
|
|
29
|
|
|
|
|
12714
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub is { |
14
|
4043
|
|
|
4043
|
1
|
5424
|
my ( $self ) = @_; |
15
|
4043
|
|
|
|
|
8806
|
return 'string'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub parse { |
19
|
613
|
|
|
613
|
1
|
939
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
|
21
|
613
|
|
|
|
|
863
|
my $header = $self->{ 'header' }; |
22
|
613
|
|
|
|
|
786
|
my $value = q{}; |
23
|
|
|
|
|
|
|
|
24
|
613
|
100
|
|
|
|
1295
|
croak 'Not a string' if $header =~ /^"/; |
25
|
612
|
100
|
|
|
|
1125
|
croak 'Not a string' if $header =~ /^\(/; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Parse differently if we are post assignment (we are a value) or not (we are likely a key or key part) |
28
|
611
|
|
|
|
|
849
|
my $is_value = 0; |
29
|
611
|
|
|
|
|
727
|
my $is_first = 0; |
30
|
611
|
100
|
|
|
|
1010
|
if ( exists ( $self->{ 'args' }->{ 'last_non_comment_type' } ) ) { |
31
|
552
|
100
|
|
|
|
1058
|
if ( $self->{ 'args' }->{ 'last_non_comment_type' }->is() eq 'assignment' ) { |
32
|
303
|
100
|
|
|
|
797
|
if ( $self->{ 'args' }->{ 'last_non_comment_type' }->value() eq '=' ) { |
33
|
226
|
|
|
|
|
341
|
$is_value = 1; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
59
|
|
|
|
|
114
|
$is_first = 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
611
|
|
|
|
|
1325
|
while ( length $header > 0 ) { |
42
|
4966
|
|
|
|
|
6861
|
my $first = substr( $header,0,1 ); |
43
|
4966
|
100
|
|
|
|
8575
|
last if $first =~ /\s/; |
44
|
4772
|
100
|
|
|
|
7246
|
last if $first eq ';'; |
45
|
4679
|
0
|
33
|
|
|
7290
|
last if $first eq '"' && ! $is_value && ! $is_first; |
|
|
|
33
|
|
|
|
|
46
|
4679
|
0
|
33
|
|
|
7117
|
last if $first eq '(' && ! $is_value && ! $is_first; |
|
|
|
33
|
|
|
|
|
47
|
4679
|
100
|
100
|
|
|
8105
|
last if $first eq '=' && ! $is_value && ! $is_first; |
|
|
|
66
|
|
|
|
|
48
|
4459
|
50
|
66
|
|
|
6989
|
last if $first eq '/' && ! $is_value && ! $is_first; |
|
|
|
33
|
|
|
|
|
49
|
4459
|
100
|
100
|
|
|
7660
|
last if $first eq '.' && ! $is_value && ! $is_first; |
|
|
|
100
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
4389
|
|
|
|
|
5145
|
$value .= $first; |
52
|
4389
|
|
|
|
|
9128
|
$header = substr( $header,1 ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
611
|
100
|
|
|
|
1137
|
croak 'Not a string' if $value eq q{}; |
56
|
|
|
|
|
|
|
|
57
|
606
|
|
|
|
|
1084
|
$self->{ 'value' } = $value; |
58
|
606
|
|
|
|
|
857
|
$self->{ 'header' } = $header; |
59
|
|
|
|
|
|
|
|
60
|
606
|
|
|
|
|
1109
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |