File Coverage

blib/lib/XML/SRS/TimeStamp.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1              
2             package XML::SRS::TimeStamp;
3              
4 2     2   2327 use Moose;
  0            
  0            
5             use PRANG::Graph;
6              
7             with 'XML::SRS::TimeStamp::Role', 'XML::SRS::Node';
8              
9             use Moose::Util::TypeConstraints;
10             use MooseX::Timestamp qw();
11             use MooseX::TimestampTZ qw();
12             use XML::SRS::Types;
13              
14             coerce __PACKAGE__
15             => from Timestamp
16             => via {
17             __PACKAGE__->new(timestamp => $_);
18             };
19              
20             coerce __PACKAGE__
21             => from TimestampTZ
22             => via {
23             __PACKAGE__->new(timestamptz => $_);
24             };
25              
26             coerce __PACKAGE__
27             => from "Str"
28             => via {
29             __PACKAGE__->new(timestamptz => $_);
30             };
31              
32             coerce __PACKAGE__
33             => from "Int"
34             => via {
35             __PACKAGE__->new(epoch => $_);
36             };
37              
38             sub BUILDARGS {
39             my $class = shift;
40             my %args = @_;
41             %args = (%args, $class->buildargs_timestamp($args{timestamp}))
42             if $args{timestamp};
43             %args = (%args, $class->buildargs_timestamptz($args{timestamptz}))
44             if $args{timestamptz};
45             %args = (%args, $class->buildargs_epoch($args{epoch}))
46             if $args{epoch};
47             \%args;
48             }
49              
50             1;