File Coverage

blib/lib/Value/Object/W3CDateTime.pm
Criterion Covered Total %
statement 22 22 100.0
branch 10 10 100.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 37 37 100.0


line stmt bran cond sub pod time code
1             package Value::Object::W3CDateTime;
2              
3 2     2   25637 use strict;
  2         4  
  2         48  
4 2     2   10 use warnings;
  2         5  
  2         49  
5              
6 2     2   1081 use Value::Object::ValidationUtils;
  2         5  
  2         63  
7              
8 2     2   697 use parent 'Value::Object';
  2         313  
  2         14  
9              
10             our $VERSION = '0.14';
11              
12             sub _why_invalid
13             {
14 44     44   70 my ( $self, $value ) = @_;
15 44 100       104 return ( ref($self) . ': value is undefined', '', undef ) unless defined $value;
16 43 100       87 return ( ref($self) . ': value is empty', '', undef ) unless length $value;
17 42 100       116 return ( ref($self) . ': value is mssing time separator', '', undef )
18             unless $value =~ tr/T//;
19 37         115 my ($date, $time) = split /T/, $value;
20 37         106 my ($why, $long, $data) = Value::Object::ValidationUtils::why_invalid_iso_8601_date( $date );
21 37 100       145 return ( ref($self) . ": $why", $long, $data ) if defined $why;
22              
23 21         57 ($why, $long, $data) = Value::Object::ValidationUtils::why_invalid_iso_8601_time( $time );
24 21 100       128 return ( ref($self) . ": $why", $long, $data ) if defined $why;
25 2         6 return;
26             }
27              
28             1;
29             __END__