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
|
30
|
|
|
30
|
|
598
|
use strict; |
|
30
|
|
|
|
|
65
|
|
|
30
|
|
|
|
|
932
|
|
6
|
30
|
|
|
30
|
|
155
|
use warnings; |
|
30
|
|
|
|
|
53
|
|
|
30
|
|
|
|
|
1332
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.20230112'; # VERSION |
8
|
30
|
|
|
30
|
|
180
|
use Carp; |
|
30
|
|
|
|
|
58
|
|
|
30
|
|
|
|
|
1789
|
|
9
|
|
|
|
|
|
|
|
10
|
30
|
|
|
30
|
|
237
|
use base 'Mail::AuthenticationResults::Token'; |
|
30
|
|
|
|
|
58
|
|
|
30
|
|
|
|
|
12942
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub is { |
14
|
4346
|
|
|
4346
|
1
|
5794
|
my ( $self ) = @_; |
15
|
4346
|
|
|
|
|
9151
|
return 'string'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub parse { |
19
|
651
|
|
|
651
|
1
|
954
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
|
21
|
651
|
|
|
|
|
901
|
my $header = $self->{ 'header' }; |
22
|
651
|
|
|
|
|
899
|
my $value = q{}; |
23
|
|
|
|
|
|
|
|
24
|
651
|
100
|
|
|
|
1319
|
croak 'Not a string' if $header =~ /^"/; |
25
|
650
|
100
|
|
|
|
1174
|
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
|
649
|
|
|
|
|
769
|
my $is_value = 0; |
29
|
649
|
|
|
|
|
775
|
my $is_first = 0; |
30
|
649
|
100
|
|
|
|
1099
|
if ( exists ( $self->{ 'args' }->{ 'last_non_comment_type' } ) ) { |
31
|
589
|
100
|
|
|
|
1168
|
if ( $self->{ 'args' }->{ 'last_non_comment_type' }->is() eq 'assignment' ) { |
32
|
324
|
100
|
|
|
|
721
|
if ( $self->{ 'args' }->{ 'last_non_comment_type' }->value() eq '=' ) { |
33
|
241
|
|
|
|
|
354
|
$is_value = 1; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
60
|
|
|
|
|
100
|
$is_first = 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
649
|
|
|
|
|
1352
|
while ( length $header > 0 ) { |
42
|
5298
|
|
|
|
|
6768
|
my $first = substr( $header,0,1 ); |
43
|
5298
|
100
|
|
|
|
9101
|
last if $first =~ /\s/; |
44
|
5093
|
100
|
|
|
|
7475
|
last if $first eq ';'; |
45
|
4996
|
0
|
33
|
|
|
7822
|
last if $first eq '"' && ! $is_value && ! $is_first; |
|
|
|
33
|
|
|
|
|
46
|
4996
|
0
|
33
|
|
|
7713
|
last if $first eq '(' && ! $is_value && ! $is_first; |
|
|
|
33
|
|
|
|
|
47
|
4996
|
100
|
100
|
|
|
8424
|
last if $first eq '=' && ! $is_value && ! $is_first; |
|
|
|
66
|
|
|
|
|
48
|
4760
|
50
|
66
|
|
|
7520
|
last if $first eq '/' && ! $is_value && ! $is_first; |
|
|
|
33
|
|
|
|
|
49
|
4760
|
100
|
100
|
|
|
9640
|
last if $first eq '.' && ! $is_value && ! $is_first; |
|
|
|
100
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
4684
|
|
|
|
|
5502
|
$value .= $first; |
52
|
4684
|
|
|
|
|
8928
|
$header = substr( $header,1 ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
649
|
100
|
|
|
|
1184
|
croak 'Not a string' if $value eq q{}; |
56
|
|
|
|
|
|
|
|
57
|
644
|
|
|
|
|
1152
|
$self->{ 'value' } = $value; |
58
|
644
|
|
|
|
|
838
|
$self->{ 'header' } = $header; |
59
|
|
|
|
|
|
|
|
60
|
644
|
|
|
|
|
1115
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |