line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DateTime::Types; |
2
|
|
|
|
|
|
|
|
3
|
49
|
|
|
49
|
|
723
|
use strict; |
|
49
|
|
|
|
|
93
|
|
|
49
|
|
|
|
|
1377
|
|
4
|
49
|
|
|
49
|
|
248
|
use warnings; |
|
49
|
|
|
|
|
124
|
|
|
49
|
|
|
|
|
1276
|
|
5
|
49
|
|
|
49
|
|
271
|
use namespace::autoclean; |
|
49
|
|
|
|
|
130
|
|
|
49
|
|
|
|
|
278
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.60'; |
8
|
|
|
|
|
|
|
|
9
|
49
|
|
|
49
|
|
25078
|
use parent 'Specio::Exporter'; |
|
49
|
|
|
|
|
14493
|
|
|
49
|
|
|
|
|
255
|
|
10
|
|
|
|
|
|
|
|
11
|
49
|
|
|
49
|
|
322579
|
use Specio 0.18; |
|
49
|
|
|
|
|
8083
|
|
|
49
|
|
|
|
|
1438
|
|
12
|
49
|
|
|
49
|
|
23511
|
use Specio::Declare; |
|
49
|
|
|
|
|
3368638
|
|
|
49
|
|
|
|
|
752
|
|
13
|
49
|
|
|
49
|
|
33834
|
use Specio::Library::Builtins -reexport; |
|
49
|
|
|
|
|
1193444
|
|
|
49
|
|
|
|
|
682
|
|
14
|
49
|
|
|
49
|
|
492897
|
use Specio::Library::Numeric -reexport; |
|
49
|
|
|
|
|
631284
|
|
|
49
|
|
|
|
|
524
|
|
15
|
49
|
|
|
49
|
|
429549
|
use Specio::Library::String; |
|
49
|
|
|
|
|
534315
|
|
|
49
|
|
|
|
|
436
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
any_can_type( |
18
|
|
|
|
|
|
|
'ConvertibleObject', |
19
|
|
|
|
|
|
|
methods => ['utc_rd_values'], |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
declare( |
23
|
|
|
|
|
|
|
'DayOfMonth', |
24
|
|
|
|
|
|
|
parent => t('Int'), |
25
|
|
|
|
|
|
|
inline => sub { |
26
|
|
|
|
|
|
|
$_[0]->parent->inline_check( $_[1] ) |
27
|
|
|
|
|
|
|
. " && $_[1] >= 1 && $_[1] <= 31"; |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
declare( |
32
|
|
|
|
|
|
|
'DayOfYear', |
33
|
|
|
|
|
|
|
parent => t('Int'), |
34
|
|
|
|
|
|
|
inline => sub { |
35
|
|
|
|
|
|
|
$_[0]->parent->inline_check( $_[1] ) |
36
|
|
|
|
|
|
|
. " && $_[1] >= 1 && $_[1] <= 366"; |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
object_isa_type( |
41
|
|
|
|
|
|
|
'Duration', |
42
|
|
|
|
|
|
|
class => 'DateTime::Duration', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
enum( |
46
|
|
|
|
|
|
|
'EndOfMonthMode', |
47
|
|
|
|
|
|
|
values => [qw( wrap limit preserve )], |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
any_can_type( |
51
|
|
|
|
|
|
|
'Formatter', |
52
|
|
|
|
|
|
|
methods => ['format_datetime'], |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $locale_object = declare( |
56
|
|
|
|
|
|
|
'LocaleObject', |
57
|
|
|
|
|
|
|
parent => t('Object'), |
58
|
|
|
|
|
|
|
inline => sub { |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Can't use $_[1] directly because 5.8 gives very weird errors |
61
|
|
|
|
|
|
|
my $var = $_[1]; |
62
|
|
|
|
|
|
|
<<"EOF"; |
63
|
|
|
|
|
|
|
( |
64
|
|
|
|
|
|
|
$var->isa('DateTime::Locale::FromData') |
65
|
|
|
|
|
|
|
|| $var->isa('DateTime::Locale::Base') |
66
|
|
|
|
|
|
|
) |
67
|
|
|
|
|
|
|
EOF |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
union( |
72
|
|
|
|
|
|
|
'Locale', |
73
|
|
|
|
|
|
|
of => [ t('NonEmptySimpleStr'), $locale_object ], |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $time_zone_object = object_can_type( |
77
|
|
|
|
|
|
|
'TZObject', |
78
|
|
|
|
|
|
|
methods => [ |
79
|
|
|
|
|
|
|
qw( |
80
|
|
|
|
|
|
|
is_floating |
81
|
|
|
|
|
|
|
is_utc |
82
|
|
|
|
|
|
|
name |
83
|
|
|
|
|
|
|
offset_for_datetime |
84
|
|
|
|
|
|
|
short_name_for_datetime |
85
|
|
|
|
|
|
|
) |
86
|
|
|
|
|
|
|
], |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
declare( |
90
|
|
|
|
|
|
|
'TimeZone', |
91
|
|
|
|
|
|
|
of => [ t('NonEmptySimpleStr'), $time_zone_object ], |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
declare( |
95
|
|
|
|
|
|
|
'Hour', |
96
|
|
|
|
|
|
|
parent => t('PositiveOrZeroInt'), |
97
|
|
|
|
|
|
|
inline => sub { |
98
|
|
|
|
|
|
|
$_[0]->parent->inline_check( $_[1] ) |
99
|
|
|
|
|
|
|
. " && $_[1] >= 0 && $_[1] <= 23"; |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
declare( |
104
|
|
|
|
|
|
|
'Minute', |
105
|
|
|
|
|
|
|
parent => t('PositiveOrZeroInt'), |
106
|
|
|
|
|
|
|
inline => sub { |
107
|
|
|
|
|
|
|
$_[0]->parent->inline_check( $_[1] ) |
108
|
|
|
|
|
|
|
. " && $_[1] >= 0 && $_[1] <= 59"; |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
declare( |
113
|
|
|
|
|
|
|
'Month', |
114
|
|
|
|
|
|
|
parent => t('PositiveInt'), |
115
|
|
|
|
|
|
|
inline => sub { |
116
|
|
|
|
|
|
|
$_[0]->parent->inline_check( $_[1] ) |
117
|
|
|
|
|
|
|
. " && $_[1] >= 1 && $_[1] <= 12"; |
118
|
|
|
|
|
|
|
}, |
119
|
|
|
|
|
|
|
); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
declare( |
122
|
|
|
|
|
|
|
'Nanosecond', |
123
|
|
|
|
|
|
|
parent => t('PositiveOrZeroInt'), |
124
|
|
|
|
|
|
|
); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
declare( |
127
|
|
|
|
|
|
|
'Second', |
128
|
|
|
|
|
|
|
parent => t('PositiveOrZeroInt'), |
129
|
|
|
|
|
|
|
inline => sub { |
130
|
|
|
|
|
|
|
$_[0]->parent->inline_check( $_[1] ) |
131
|
|
|
|
|
|
|
. " && $_[1] >= 0 && $_[1] <= 61"; |
132
|
|
|
|
|
|
|
}, |
133
|
|
|
|
|
|
|
); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
enum( |
136
|
|
|
|
|
|
|
'TruncationLevel', |
137
|
|
|
|
|
|
|
values => [ |
138
|
|
|
|
|
|
|
qw( |
139
|
|
|
|
|
|
|
year |
140
|
|
|
|
|
|
|
quarter |
141
|
|
|
|
|
|
|
month |
142
|
|
|
|
|
|
|
day hour |
143
|
|
|
|
|
|
|
minute |
144
|
|
|
|
|
|
|
second |
145
|
|
|
|
|
|
|
nanosecond |
146
|
|
|
|
|
|
|
week |
147
|
|
|
|
|
|
|
local_week |
148
|
|
|
|
|
|
|
) |
149
|
|
|
|
|
|
|
], |
150
|
|
|
|
|
|
|
); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
declare( |
153
|
|
|
|
|
|
|
'Year', |
154
|
|
|
|
|
|
|
parent => t('Int'), |
155
|
|
|
|
|
|
|
); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
1; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# ABSTRACT: Types used for parameter checking in DateTime |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
__END__ |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=pod |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=encoding UTF-8 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 NAME |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
DateTime::Types - Types used for parameter checking in DateTime |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 VERSION |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
version 1.60 |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 DESCRIPTION |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
This module has no user-facing parts. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=for Pod::Coverage .* |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 SUPPORT |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/DateTime.pm/issues>. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
There is a mailing list available for users of this distribution, |
186
|
|
|
|
|
|
|
L<mailto:datetime@perl.org>. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 SOURCE |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
The source code repository for DateTime can be found at L<https://github.com/houseabsolute/DateTime.pm>. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 AUTHOR |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This software is Copyright (c) 2003 - 2023 by Dave Rolsky. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
This is free software, licensed under: |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
The full text of the license can be found in the |
205
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |