File Coverage

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 3     3   25887 use strict;
  3         6  
  3         73  
4 3     3   28 use warnings;
  3         6  
  3         79  
5              
6 3     3   1214 use Value::Object::ValidationUtils;
  3         5  
  3         85  
7              
8 3     3   691 use parent 'Value::Object';
  3         314  
  3         20  
9              
10             our $VERSION = '0.15';
11              
12             sub _why_invalid
13             {
14 44     44   63 my ( $self, $value ) = @_;
15 44 100       109 return ( ref($self) . ': value is undefined', '', undef ) unless defined $value;
16 43 100       97 return ( ref($self) . ': value is empty', '', undef ) unless length $value;
17 42 100       112 return ( ref($self) . ': value is mssing time separator', '', undef )
18             unless $value =~ tr/T//;
19 37         111 my ($date, $time) = split /T/, $value;
20 37         111 my ($why, $long, $data) = Value::Object::ValidationUtils::why_invalid_iso_8601_date( $date );
21 37 100       139 return ( ref($self) . ": $why", $long, $data ) if defined $why;
22              
23 21         51 ($why, $long, $data) = Value::Object::ValidationUtils::why_invalid_iso_8601_time( $time );
24 21 100       120 return ( ref($self) . ": $why", $long, $data ) if defined $why;
25 2         6 return;
26             }
27              
28             1;
29             __END__