« blib/lib/Mail/AuthenticationResults/Header/Group.pm
↑ Summary
blib/lib/Mail/AuthenticationResults/Token/Comment.pm »
| 1 | package Mail::AuthenticationResults::Token::String; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Class for modelling AuthenticationResults Header parts detected as strings | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 31 | require 5.008; | |||||||||||||||||||||||||||||||||||||||||
| 5 | 31 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 31 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 31 | our $VERSION = '2.20260216'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 8 | 31 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 31 | ▶ | use base 'Mail::AuthenticationResults::Token'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4486 | ▶ | sub is { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 4486 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 4486 | return 'string'; | |||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 657 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=25 SCAR=32.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 657 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 657 | my $header = $self->{ 'header' }; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 657 | my $value = q{}; | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 657 | ▶ | croak 'Not a string' if $header =~ /^"/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 656 | ▶ | croak 'Not a string' if $header =~ /^\(/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # Parse differently if we are post assignment (we are a value) or not (we are likely a key or key part) | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 655 | my $is_value = 0; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 655 | my $is_first = 0; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 655 | ▶ | if ( exists ( $self->{ 'args' }->{ 'last_non_comment_type' } ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 594 | ▶ | if ( $self->{ 'args' }->{ 'last_non_comment_type' }->is() eq 'assignment' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 326 | ▶ | if ( $self->{ 'args' }->{ 'last_non_comment_type' }->value() eq '=' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 243 | $is_value = 1; | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 61 | $is_first = 1; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 655 | ▶ | while ( length $header > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 5364 | my $first = substr( $header,0,1 ); | |||||||||||||||||||||||||||||||||||||||||
| 43 | 5364 | ▶ | last if $first =~ /\s/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 5159 | ▶ | last if $first eq ';'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 5061 | ▶ | last if $first eq '"' && ! $is_value && ! $is_first; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$first eq "\"" and not $is_value and not $is_first
$first eq "\"" and not $is_value
MC/DC0%0/3
$first eq "\"" and not $is_value and not $is_first
$first eq "\""
not $is_value
not $is_first
Truth table25%1/4
A and not(B) and not(C)
A= $first eq "\""B= not $is_valueC= not $is_first
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 5061 | ▶ | last if $first eq '(' && ! $is_value && ! $is_first; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$first eq "(" and not $is_value and not $is_first
$first eq "(" and not $is_value
MC/DC0%0/3
$first eq "(" and not $is_value and not $is_first
$first eq "("
not $is_value
not $is_first
Truth table25%1/4
A and not(B) and not(C)
A= $first eq "("B= not $is_valueC= not $is_first
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 5061 | ▶ | last if $first eq '=' && ! $is_value && ! $is_first; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$first eq "=" and not $is_value and not $is_first
$first eq "=" and not $is_value
MC/DC66%2/3
$first eq "=" and not $is_value and not $is_first
$first eq "="
not $is_value
not $is_first
Truth table75%3/4
A and not(B) and not(C)
A= $first eq "="B= not $is_valueC= not $is_first
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 4822 | ▶ | last if $first eq '/' && ! $is_value && ! $is_first; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$first eq "/" and not $is_value and not $is_first
$first eq "/" and not $is_value
MC/DC66%2/3
$first eq "/" and not $is_value and not $is_first
$first eq "/"
not $is_value
not $is_first
Truth table75%3/4
A and not(B) and not(C)
A= $first eq "/"B= not $is_valueC= not $is_first
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 4821 | ▶ | last if $first eq '.' && ! $is_value && ! $is_first; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$first eq "." and not $is_value and not $is_first
$first eq "." and not $is_value
MC/DC100%3/3
$first eq "." and not $is_value and not $is_first
$first eq "."
not $is_value
not $is_first
Truth table100%4/4
A and not(B) and not(C)
A= $first eq "."B= not $is_valueC= not $is_first
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 4745 | $value .= $first; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 4745 | $header = substr( $header,1 ); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 655 | ▶ | croak 'Not a string' if $value eq q{}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 649 | $self->{ 'value' } = $value; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 649 | $self->{ 'header' } = $header; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 649 | return; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 31 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||||||||||||||||||||||||