line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package XML::SRS::Time; |
3
|
|
|
|
|
|
|
BEGIN { |
4
|
1
|
|
|
1
|
|
1928
|
$XML::SRS::Time::VERSION = '0.09'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
384
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use PRANG::Graph; |
9
|
|
|
|
|
|
|
use Moose::Util::TypeConstraints; |
10
|
|
|
|
|
|
|
use MooseX::Params::Validate; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN{ |
13
|
|
|
|
|
|
|
subtype 'XML::SRS::Time::Hour' |
14
|
|
|
|
|
|
|
=> as "Int", |
15
|
|
|
|
|
|
|
=> where { |
16
|
|
|
|
|
|
|
$_ >= 0 and $_ <= 23; |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
subtype 'XML::SRS::Time::Sexagesimal' |
19
|
|
|
|
|
|
|
=> as "Int", |
20
|
|
|
|
|
|
|
=> where { |
21
|
|
|
|
|
|
|
$_ >= 0 and $_ <= 59; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
subtype 'XML::SRS::Time::TZOffset' |
24
|
|
|
|
|
|
|
=> as "Str", |
25
|
|
|
|
|
|
|
=> where { |
26
|
|
|
|
|
|
|
m{^[-+][\s\d]?\d(?::?\d\d)?$}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
subtype 'XML::SRS::Time::hms' |
31
|
|
|
|
|
|
|
=> as "Str", |
32
|
|
|
|
|
|
|
=> where { |
33
|
|
|
|
|
|
|
m{^(\d{1,2}):(\d{1,2}):(\d{1,2})$}; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub buildargs_time { |
38
|
|
|
|
|
|
|
my $inc = shift; |
39
|
|
|
|
|
|
|
my ( $hms, $offset ) = pos_validated_list( |
40
|
|
|
|
|
|
|
\@_, |
41
|
|
|
|
|
|
|
{ isa => 'XML::SRS::Time::hms' }, |
42
|
|
|
|
|
|
|
{ isa => 'Maybe[XML::SRS::Time::TZOffset]', optional => 1 }, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my @buildargs; |
46
|
|
|
|
|
|
|
if (defined $offset) { |
47
|
|
|
|
|
|
|
push @buildargs, tz_offset => $offset; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
my ($h, $m, $s) = split ":", $hms; |
50
|
|
|
|
|
|
|
push @buildargs, hour => $h, minute => $m, second => $s; |
51
|
|
|
|
|
|
|
@buildargs; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has_attr 'hour' => |
55
|
|
|
|
|
|
|
is => "rw", |
56
|
|
|
|
|
|
|
isa => "XML::SRS::Time::Sexagesimal", |
57
|
|
|
|
|
|
|
required => 1, |
58
|
|
|
|
|
|
|
xml_name => "Hour", |
59
|
|
|
|
|
|
|
; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has_attr 'minute' => |
62
|
|
|
|
|
|
|
is => "rw", |
63
|
|
|
|
|
|
|
isa => "XML::SRS::Time::Sexagesimal", |
64
|
|
|
|
|
|
|
required => 1, |
65
|
|
|
|
|
|
|
xml_name => "Minute", |
66
|
|
|
|
|
|
|
; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
has_attr 'second' => |
69
|
|
|
|
|
|
|
is => "rw", |
70
|
|
|
|
|
|
|
isa => "XML::SRS::Time::Sexagesimal", |
71
|
|
|
|
|
|
|
xml_name => "Second", |
72
|
|
|
|
|
|
|
; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has_attr 'tz_offset' => |
75
|
|
|
|
|
|
|
is => "rw", |
76
|
|
|
|
|
|
|
isa => "XML::SRS::Time::TZOffset", |
77
|
|
|
|
|
|
|
xml_required => 0, |
78
|
|
|
|
|
|
|
clearer => "make_floating", |
79
|
|
|
|
|
|
|
xml_name => "TimeZoneOffset", |
80
|
|
|
|
|
|
|
; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |