« blib/lib/Mail/AuthenticationResults/Token/Separator.pm
↑ Summary
lib/Mail/AuthenticationResults/Header/Version.pm »
| 1 | package Mail::AuthenticationResults::Token::QuotedString; | ||||||||||
| 2 | # ABSTRACT: Class for modelling AuthenticationResults Header parts detected as quoted strings | ||||||||||
| 3 | |||||||||||
| 4 | 25 | require 5.008; | |||||||||
| 5 | 25 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 25 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 25 | our $VERSION = '2.20260216'; # VERSION | |||||||||
| 8 | 25 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 25 | ▶ | use base 'Mail::AuthenticationResults::Token'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | 192 | ▶ | sub is { | ||||||||
|
Subroutine
is: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 14 | 192 | my ( $self ) = @_; | |||||||||
| 15 | 192 | return 'string'; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 42 | ▶ | sub parse { | ||||||||
|
Subroutine
parse: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||
| 19 | 42 | my ($self) = @_; | |||||||||
| 20 | |||||||||||
| 21 | 42 | my $header = $self->{ 'header' }; | |||||||||
| 22 | 42 | my $value = q{}; | |||||||||
| 23 | |||||||||||
| 24 | 42 | my $first = substr( $header,0,1 ); | |||||||||
| 25 | 42 | $header = substr( $header,1 ); | |||||||||
| 26 | 42 | ▶ | croak 'not a quoted string' if $first ne '"'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 41 | my $closed = 0; | |||||||||
| 29 | 41 | ▶ | while ( length $header > 0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 368 | my $first = substr( $header,0,1 ); | |||||||||
| 31 | 368 | $header = substr( $header,1 ); | |||||||||
| 32 | 368 | ▶ | if ( $first eq '"' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 40 | $closed = 1; | |||||||||
| 34 | 40 | last; | |||||||||
| 35 | } | ||||||||||
| 36 | 328 | $value .= $first; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 41 | ▶ | croak 'Quoted string not closed' if ! $closed; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | |||||||||||
| 41 | 40 | $self->{ 'value' } = $value; | |||||||||
| 42 | 40 | $self->{ 'header' } = $header; | |||||||||
| 43 | |||||||||||
| 44 | 40 | return; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 25 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||