File Coverage

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


line stmt bran cond sub pod time code
1              
2             package XML::SRS::TimeStamp;
3             BEGIN {
4 2     2   4020 $XML::SRS::TimeStamp::VERSION = '0.09';
5             }
6              
7 2     2   933 use Moose;
  0            
  0            
8             use PRANG::Graph;
9              
10             with 'XML::SRS::TimeStamp::Role', 'XML::SRS::Node';
11              
12             use Moose::Util::TypeConstraints;
13             use MooseX::Timestamp qw();
14             use MooseX::TimestampTZ qw();
15             use XML::SRS::Types;
16              
17             coerce __PACKAGE__
18             => from Timestamp
19             => via {
20             __PACKAGE__->new(timestamp => $_);
21             };
22              
23             coerce __PACKAGE__
24             => from TimestampTZ
25             => via {
26             __PACKAGE__->new(timestamptz => $_);
27             };
28              
29             coerce __PACKAGE__
30             => from "Str"
31             => via {
32             __PACKAGE__->new(timestamptz => $_);
33             };
34              
35             coerce __PACKAGE__
36             => from "Int"
37             => via {
38             __PACKAGE__->new(epoch => $_);
39             };
40              
41             sub BUILDARGS {
42             my $class = shift;
43             my %args = @_;
44             %args = (%args, $class->buildargs_timestamp($args{timestamp}))
45             if $args{timestamp};
46             %args = (%args, $class->buildargs_timestamptz($args{timestamptz}))
47             if $args{timestamptz};
48             %args = (%args, $class->buildargs_epoch($args{epoch}))
49             if $args{epoch};
50             \%args;
51             }
52              
53             1;
54              
55              
56             __END__
57              
58             =head1 NAME
59              
60             XML::SRS::TimeStamp - Class representing an SRS timestamp
61              
62             =head1 DESCRIPTION
63              
64             This class represents an SRS timestamp
65              
66             =head1 ATTRIBUTES
67              
68             Each attribute of this class has an accessor/mutator of the same name as
69             the attribute. Additionally, they can be passed as parameters to the
70             constructor.
71              
72             =head2 hour
73              
74             Required. Must be of type XML::SRS::Time::Sexagesimal. Maps to the XML attribute 'Hour'
75              
76             =head2 month
77              
78             Required. Must be of type XML::SRS::Number. Maps to the XML attribute 'Month'
79              
80             =head2 second
81              
82             Must be of type XML::SRS::Time::Sexagesimal. Maps to the XML attribute 'Second'
83              
84             =head2 tz_offset
85              
86             Must be of type XML::SRS::Time::TZOffset. Maps to the XML attribute 'TimeZoneOffset'
87              
88             =head2 minute
89              
90             Required. Must be of type XML::SRS::Time::Sexagesimal. Maps to the XML attribute 'Minute'
91              
92             =head2 day
93              
94             Required. Must be of type XML::SRS::Number. Maps to the XML attribute 'Day'
95              
96             =head2 year
97              
98             Required. Must be of type XML::SRS::Number. Maps to the XML attribute 'Year'
99              
100             =head1 METHODS
101              
102             =head2 new(%params)
103              
104             Construct a new XML::SRS::Request object. %params specifies the initial
105             values of the attributes.
106              
107             =head1 COMPOSED OF
108              
109             L<XML::SRS::Node>, L<XML::SRS::TimeStamp::Role>