« lib/Mail/AuthenticationResults/FoldableHeader.pm
↑ Summary
lib/Mail/AuthenticationResults/Header/Comment.pm »
| 1 | package Mail::AuthenticationResults::Token::String; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Class for modelling AuthenticationResults Header parts detected as strings | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 32 | require 5.008; | |||||||||||||||||||||||||||
| 5 | 32 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 32 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 32 | our $VERSION = '2.20261029'; # VERSION | |||||||||||||||||||||||||||
| 8 | 32 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 32 | ▶ | use base 'Mail::AuthenticationResults::Token'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 97813 | ▶ | sub is { | ||||||||||||||||||||||||||
|
Subroutine
is: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 97813 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 15 | 97813 | return 'string'; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 28657 | ▶ | sub parse { | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=11 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||
| 19 | 28657 | my ($self) = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 28657 | my $header = $self->{ 'header' }; | |||||||||||||||||||||||||||
| 22 | 28657 | my $value = q{}; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 28657 | ▶ | croak 'Not a string' if $header =~ /^"/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 28656 | ▶ | 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 | 28655 | my $is_value = 0; | |||||||||||||||||||||||||||
| 29 | 28655 | my $is_first = 0; | |||||||||||||||||||||||||||
| 30 | 28655 | ▶ | if ( exists ( $self->{ 'args' }->{ 'last_non_comment_type' } ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 28592 | ▶ | if ( $self->{ 'args' }->{ 'last_non_comment_type' }->is() eq 'assignment' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 17658 | ▶ | if ( $self->{ 'args' }->{ 'last_non_comment_type' }->value() eq '=' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 10909 | $is_value = 1; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | else { | ||||||||||||||||||||||||||||
| 38 | 63 | $is_first = 1; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 28655 | ▶ | if ( $is_value || $is_first ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$is_value or $is_first
MC/DC100%2/2
$is_value or $is_first
$is_value
$is_first
Truth table100%3/3
A or B
A= $is_valueB= $is_first
| |||||||||||||||||||||||||||||
| 42 | 10972 | ▶ | $value = $1 if $header =~ /^([^\s;]+)/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | else { | ||||||||||||||||||||||||||||
| 45 | 17683 | ▶ | $value = $1 if $header =~ /^([^\s;"(=\/.]+)/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 28655 | ▶ | croak 'Not a string' if $value eq q{}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 28649 | $header = substr( $header, length $value ); | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 28649 | $self->{ 'value' } = $value; | |||||||||||||||||||||||||||
| 53 | 28649 | $self->{ 'header' } = $header; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 28649 | return; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 32 | 1; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | __END__ | ||||||||||||||||||||||||||||