« lib/Mail/AuthenticationResults/Header/Entry.pm
↑ Summary
lib/Mail/AuthenticationResults/Header/SubEntry.pm »
| 1 | package Mail::AuthenticationResults::Token::QuotedString; | ||||||||||
| 2 | # ABSTRACT: Class for modelling AuthenticationResults Header parts detected as quoted strings | ||||||||||
| 3 | |||||||||||
| 4 | 26 | require 5.008; | |||||||||
| 5 | 26 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 26 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 26 | our $VERSION = '2.20261029'; # VERSION | |||||||||
| 8 | 26 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 26 | ▶ | 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=3 SCAR=11.0
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 | ▶ | croak 'not a quoted string' if $first ne '"'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 41 | my $end = index( $header, '"', 1 ); | |||||||||
| 28 | 41 | ▶ | croak 'Quoted string not closed' if $end == -1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | |||||||||||
| 30 | 40 | $value = substr( $header, 1, $end - 1 ); | |||||||||
| 31 | 40 | $header = substr( $header, $end + 1 ); | |||||||||
| 32 | |||||||||||
| 33 | 40 | $self->{ 'value' } = $value; | |||||||||
| 34 | 40 | $self->{ 'header' } = $header; | |||||||||
| 35 | |||||||||||
| 36 | 40 | return; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 26 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||