« lib/Mail/AuthenticationResults/Header.pm
↑ Summary
lib/Mail/AuthenticationResults/Token/Assignment.pm »
| 1 | package Mail::AuthenticationResults::Header::Version; | ||||||||||
| 2 | # ABSTRACT: Class modelling the AuthServID part of the Authentication Results Header | ||||||||||
| 3 | |||||||||||
| 4 | 30 | require 5.008; | |||||||||
| 5 | 30 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 30 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 30 | our $VERSION = '2.20261029'; # VERSION | |||||||||
| 8 | 30 | ▶ | use Scalar::Util qw{ weaken }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 30 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 30 | ▶ | use base 'Mail::AuthenticationResults::Header::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 35 | ▶ | sub _HAS_VALUE{ return 1; } | ||||||||
|
Subroutine
_HAS_VALUE: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 10 | ▶ | sub build_string { | ||||||||
|
Subroutine
build_string: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 17 | 10 | my ( $self, $header ) = @_; | |||||||||
| 18 | |||||||||||
| 19 | 10 | ▶ | if ( ! $self->value() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 1 | return; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 9 | ▶ | if ( ref $self->parent() ne 'Mail::AuthenticationResults::Header::AuthServID' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 6 | $header->separator( '/' ); | |||||||||
| 25 | 6 | $header->space( ' ' ); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 9 | $header->string( $self->value() ); | |||||||||
| 29 | |||||||||||
| 30 | 9 | return; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 3 | ▶ | sub safe_set_value { | ||||||||
|
Subroutine
safe_set_value: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 34 | 3 | my ( $self, $value ) = @_; | |||||||||
| 35 | |||||||||||
| 36 | 3 | ▶ | $value = 1 if ! defined $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 3 | $value =~ s/[^0-9]//g; | |||||||||
| 38 | 3 | ▶ | $value = 1 if $value eq q{}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | |||||||||||
| 40 | 3 | $self->set_value( $value ); | |||||||||
| 41 | 3 | return $self; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 11 | ▶ | sub set_value { | ||||||||
|
Subroutine
set_value: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 45 | 11 | my ( $self, $value ) = @_; | |||||||||
| 46 | |||||||||||
| 47 | 11 | ▶ | croak 'Does not have value' if ! $self->_HAS_VALUE(); # uncoverable branch true | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | # HAS_VALUE is 1 for this class | ||||||||||
| 49 | 11 | ▶ | croak 'Value cannot be undefined' if ! defined $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 10 | ▶ | croak 'Value must be numeric' if $value =~ /[^0-9]/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | |||||||||||
| 52 | 8 | $self->{ 'value' } = $value; | |||||||||
| 53 | 8 | return $self; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 30 | 1; | |||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||