lib/Mail/AuthenticationResults/Header/Version.pm

filter: Statementstmt 100% 39 / 39 Branchbran 100% 13 / 14 (1 uncoverable) Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 100% 64 / 65 (1 uncoverable) CC 8 SCAR 9.2
CC
8
Cov
100%
set_value
4.0
build_string
3.0
safe_set_value
3.0
CRAP 2.5
« lib/Mail/AuthenticationResults/Token/QuotedString.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 29 require 5.008;
5 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 our $VERSION = '2.20260216'; # VERSION
8 29 ▶use Scalar::Util qw{ weaken };
Subroutine BEGIN: called CC=1 SCAR=0.0
9 29 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 29 ▶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
BranchTrueFalseTotal
unless ($self->value) 1 9 10
20 1 return;
21 }
22  
23 9 ▶ if ( ref $self->parent() ne 'Mail::AuthenticationResults::Header::AuthServID' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->parent ne "Mail::AuthenticationResults::Header::AuthServID") 6 3 9
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
BranchTrueFalseTotal
unless defined $value 1 2 3
37 3 $value =~ s/[^0-9]//g;
38 3 ▶ $value = 1 if $value eq q{};
Branch: 1 branch
BranchTrueFalseTotal
if $value eq "" 2 1 3
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
BranchTrueFalseTotal
unless $self->_HAS_VALUE 0 11 11
48 # HAS_VALUE is 1 for this class
49 11 ▶ croak 'Value cannot be undefined' if ! defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 1 10 11
50 10 ▶ croak 'Value must be numeric' if $value =~ /[^0-9]/;
Branch: 1 branch
BranchTrueFalseTotal
if $value =~ /[^0-9]/ 2 8 10
51  
52 8 $self->{ 'value' } = $value;
53 8 return $self;
54 }
55  
56 29 1;
57  
58 __END__
« lib/Mail/AuthenticationResults/Token/QuotedString.pm ↑ Summary lib/Mail/AuthenticationResults/Token/Assignment.pm »