| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MooseX::Types::XMLSchema; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
2
|
|
|
2
|
|
610612
|
$MooseX::Types::XMLSchema::AUTHORITY = 'cpan:AJGB'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
|
|
|
|
|
|
$MooseX::Types::XMLSchema::VERSION = '0.06'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
#ABSTRACT: XMLSchema compatible Moose types library |
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
49
|
|
|
11
|
2
|
|
|
2
|
|
8
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
104
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
27
|
use MooseX::Types -declare => [qw( |
|
14
|
|
|
|
|
|
|
xs:string |
|
15
|
|
|
|
|
|
|
xs:integer |
|
16
|
|
|
|
|
|
|
xs:positiveInteger |
|
17
|
|
|
|
|
|
|
xs:nonPositiveInteger |
|
18
|
|
|
|
|
|
|
xs:negativeInteger |
|
19
|
|
|
|
|
|
|
xs:nonNegativeInteger |
|
20
|
|
|
|
|
|
|
xs:long |
|
21
|
|
|
|
|
|
|
xs:unsignedLong |
|
22
|
|
|
|
|
|
|
xs:int |
|
23
|
|
|
|
|
|
|
xs:unsignedInt |
|
24
|
|
|
|
|
|
|
xs:short |
|
25
|
|
|
|
|
|
|
xs:unsignedShort |
|
26
|
|
|
|
|
|
|
xs:byte |
|
27
|
|
|
|
|
|
|
xs:unsignedByte |
|
28
|
|
|
|
|
|
|
xs:boolean |
|
29
|
|
|
|
|
|
|
xs:float |
|
30
|
|
|
|
|
|
|
xs:double |
|
31
|
|
|
|
|
|
|
xs:decimal |
|
32
|
|
|
|
|
|
|
xs:duration |
|
33
|
|
|
|
|
|
|
xs:dateTime |
|
34
|
|
|
|
|
|
|
xs:time |
|
35
|
|
|
|
|
|
|
xs:date |
|
36
|
|
|
|
|
|
|
xs:gYearMonth |
|
37
|
|
|
|
|
|
|
xs:gYear |
|
38
|
|
|
|
|
|
|
xs:gMonthDay |
|
39
|
|
|
|
|
|
|
xs:gDay |
|
40
|
|
|
|
|
|
|
xs:gMonth |
|
41
|
|
|
|
|
|
|
xs:base64Binary |
|
42
|
|
|
|
|
|
|
xs:anyURI |
|
43
|
2
|
|
|
2
|
|
1432
|
)]; |
|
|
2
|
|
|
|
|
432642
|
|
|
44
|
2
|
|
|
2
|
|
26240
|
use Moose::Util::TypeConstraints; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
8
|
|
|
45
|
2
|
|
|
|
|
22
|
use MooseX::Types::Moose qw( |
|
46
|
|
|
|
|
|
|
Str |
|
47
|
|
|
|
|
|
|
Int |
|
48
|
|
|
|
|
|
|
Num |
|
49
|
|
|
|
|
|
|
Bool |
|
50
|
|
|
|
|
|
|
ArrayRef |
|
51
|
2
|
|
|
2
|
|
4567
|
); |
|
|
2
|
|
|
|
|
24125
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
2
|
|
|
2
|
|
10326
|
use Regexp::Common qw( number ); |
|
|
2
|
|
|
|
|
4292
|
|
|
|
2
|
|
|
|
|
9
|
|
|
54
|
2
|
|
|
2
|
|
5503
|
use MIME::Base64 qw( encode_base64 ); |
|
|
2
|
|
|
|
|
1253
|
|
|
|
2
|
|
|
|
|
236
|
|
|
55
|
2
|
|
|
2
|
|
1085
|
use Encode qw( encode ); |
|
|
2
|
|
|
|
|
15928
|
|
|
|
2
|
|
|
|
|
155
|
|
|
56
|
2
|
|
|
2
|
|
480
|
use DateTime::Duration; |
|
|
2
|
|
|
|
|
94410
|
|
|
|
2
|
|
|
|
|
65
|
|
|
57
|
2
|
|
|
2
|
|
15
|
use DateTime::TimeZone; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
31
|
|
|
58
|
2
|
|
|
2
|
|
8
|
use DateTime; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
23
|
|
|
59
|
2
|
|
|
2
|
|
729
|
use IO::Handle; |
|
|
2
|
|
|
|
|
5149
|
|
|
|
2
|
|
|
|
|
79
|
|
|
60
|
2
|
|
|
2
|
|
544
|
use URI; |
|
|
2
|
|
|
|
|
3485
|
|
|
|
2
|
|
|
|
|
44
|
|
|
61
|
2
|
|
|
2
|
|
1052
|
use Math::BigInt; |
|
|
2
|
|
|
|
|
16296
|
|
|
|
2
|
|
|
|
|
16
|
|
|
62
|
2
|
|
|
2
|
|
16396
|
use Math::BigFloat; |
|
|
2
|
|
|
|
|
16459
|
|
|
|
2
|
|
|
|
|
12
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
class_type 'Math::BigInt'; |
|
66
|
|
|
|
|
|
|
class_type 'Math::BigFloat'; |
|
67
|
|
|
|
|
|
|
class_type 'DateTime::Duration'; |
|
68
|
|
|
|
|
|
|
class_type 'DateTime'; |
|
69
|
|
|
|
|
|
|
class_type 'IO::Handle'; |
|
70
|
|
|
|
|
|
|
class_type 'URI'; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
subtype 'xs:string' => |
|
74
|
|
|
|
|
|
|
as 'Str'; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
subtype 'xs:integer' => |
|
79
|
|
|
|
|
|
|
as 'Math::BigInt', |
|
80
|
|
|
|
|
|
|
where { ! $_->is_nan && ! $_->is_inf }; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
coerce 'xs:integer' |
|
83
|
|
|
|
|
|
|
=> from 'Int', via { Math::BigInt->new($_) } |
|
84
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigInt->new($_) }; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
subtype 'xs:positiveInteger' => as 'Math::BigInt', where { $_ > 0 }; |
|
88
|
|
|
|
|
|
|
coerce 'xs:positiveInteger' |
|
89
|
|
|
|
|
|
|
=> from 'Int', via { Math::BigInt->new($_) } |
|
90
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigInt->new($_) }; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
subtype 'xs:nonPositiveInteger' => as 'Math::BigInt', where { $_ <= 0 }; |
|
94
|
|
|
|
|
|
|
coerce 'xs:nonPositiveInteger' |
|
95
|
|
|
|
|
|
|
=> from 'Int', via { Math::BigInt->new($_) } |
|
96
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigInt->new($_) }; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
subtype 'xs:negativeInteger' => as 'Math::BigInt', where { $_ < 0 }; |
|
100
|
|
|
|
|
|
|
coerce 'xs:negativeInteger' |
|
101
|
|
|
|
|
|
|
=> from 'Int', via { Math::BigInt->new($_) } |
|
102
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigInt->new($_) }; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
subtype 'xs:nonNegativeInteger' => |
|
106
|
|
|
|
|
|
|
as 'Math::BigInt', |
|
107
|
|
|
|
|
|
|
where { $_ >= 0 }; |
|
108
|
|
|
|
|
|
|
coerce 'xs:nonNegativeInteger' |
|
109
|
|
|
|
|
|
|
=> from 'Int', via { Math::BigInt->new($_) } |
|
110
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigInt->new($_) }; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
{ |
|
114
|
|
|
|
|
|
|
my $min = Math::BigInt->new('-9223372036854775808'); |
|
115
|
|
|
|
|
|
|
my $max = Math::BigInt->new('9223372036854775807'); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
subtype 'xs:long' => |
|
118
|
|
|
|
|
|
|
as 'Math::BigInt', |
|
119
|
|
|
|
|
|
|
where { $_ <= $max && $_ >= $min }; |
|
120
|
|
|
|
|
|
|
coerce 'xs:long' |
|
121
|
|
|
|
|
|
|
=> from 'Int', via { Math::BigInt->new($_) } |
|
122
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigInt->new($_) }; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
{ |
|
127
|
|
|
|
|
|
|
my $max = Math::BigInt->new('18446744073709551615'); |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
subtype 'xs:unsignedLong' => |
|
130
|
|
|
|
|
|
|
as 'Math::BigInt', |
|
131
|
|
|
|
|
|
|
where { $_ >= 0 && $_ <= $max }; |
|
132
|
|
|
|
|
|
|
coerce 'xs:unsignedLong' |
|
133
|
|
|
|
|
|
|
=> from 'Int', via { Math::BigInt->new($_) } |
|
134
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigInt->new($_) }; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
subtype 'xs:int' => |
|
139
|
|
|
|
|
|
|
as 'Int', |
|
140
|
|
|
|
|
|
|
where { $_ <= 2147483647 && $_ >= -2147483648 }; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
subtype 'xs:unsignedInt' => |
|
144
|
|
|
|
|
|
|
as 'Int', |
|
145
|
|
|
|
|
|
|
where { $_ <= 4294967295 && $_ >= 0}; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
subtype 'xs:short' => |
|
149
|
|
|
|
|
|
|
as 'Int', |
|
150
|
|
|
|
|
|
|
where { $_ <= 32767 && $_ >= -32768 }; |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
subtype 'xs:unsignedShort' => |
|
154
|
|
|
|
|
|
|
as 'Int', |
|
155
|
|
|
|
|
|
|
where { $_ <= 65535 && $_ >= 0 }; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
subtype 'xs:byte' => |
|
159
|
|
|
|
|
|
|
as 'Int', |
|
160
|
|
|
|
|
|
|
where { $_ <= 127 && $_ >= -128 }; |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
subtype 'xs:unsignedByte' => |
|
164
|
|
|
|
|
|
|
as 'Int', |
|
165
|
|
|
|
|
|
|
where { $_ <= 255 && $_ >= 0 }; |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
subtype 'xs:boolean' => |
|
169
|
|
|
|
|
|
|
as 'Bool'; |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
{ |
|
174
|
|
|
|
|
|
|
my $m = Math::BigFloat->new(2 ** 24); |
|
175
|
|
|
|
|
|
|
my $min = $m * Math::BigFloat->new(2 ** -149); |
|
176
|
|
|
|
|
|
|
my $max = $m * Math::BigFloat->new(2 ** 104); |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
subtype 'xs:float' => |
|
179
|
|
|
|
|
|
|
as 'Math::BigFloat', |
|
180
|
|
|
|
|
|
|
where { $_->is_nan || $_->is_inf || ( $_ <= $max && $_ >= $min ) }; |
|
181
|
|
|
|
|
|
|
coerce 'xs:float' |
|
182
|
|
|
|
|
|
|
=> from 'Num', via { Math::BigFloat->new($_) } |
|
183
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigFloat->new($_) }; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
{ |
|
188
|
|
|
|
|
|
|
my $m = Math::BigFloat->new(2 ** 53); |
|
189
|
|
|
|
|
|
|
my $min = $m * Math::BigFloat->new(2 ** -1075); |
|
190
|
|
|
|
|
|
|
my $max = $m * Math::BigFloat->new(2 ** 970); |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
subtype 'xs:double' => |
|
193
|
|
|
|
|
|
|
as 'Math::BigFloat', |
|
194
|
|
|
|
|
|
|
where { $_->is_nan || $_->is_inf || ( $_ < $max && $_ > $min ) }; |
|
195
|
|
|
|
|
|
|
coerce 'xs:double' |
|
196
|
|
|
|
|
|
|
=> from 'Num', via { Math::BigFloat->new($_) } |
|
197
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigFloat->new($_) }; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
subtype 'xs:decimal' => |
|
202
|
|
|
|
|
|
|
as 'Math::BigFloat', |
|
203
|
|
|
|
|
|
|
where { ! $_->is_nan && ! $_->is_inf }; |
|
204
|
|
|
|
|
|
|
coerce 'xs:decimal' |
|
205
|
|
|
|
|
|
|
=> from 'Num', via { Math::BigFloat->new($_) } |
|
206
|
|
|
|
|
|
|
=> from 'Str', via { Math::BigFloat->new($_) }; |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
subtype 'xs:duration' => |
|
211
|
|
|
|
|
|
|
as 'Str' => |
|
212
|
|
|
|
|
|
|
where { /^\-?P\d+Y\d+M\d+DT\d+H\d+M\d+(?:\.\d+)?S$/ }; |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
coerce 'xs:duration' |
|
215
|
|
|
|
|
|
|
=> from 'DateTime::Duration' => |
|
216
|
|
|
|
|
|
|
via { |
|
217
|
|
|
|
|
|
|
my $is_negative; |
|
218
|
|
|
|
|
|
|
if ($_->is_negative) { |
|
219
|
|
|
|
|
|
|
$is_negative = 1; |
|
220
|
|
|
|
|
|
|
$_ = $_->inverse; |
|
221
|
|
|
|
|
|
|
} |
|
222
|
|
|
|
|
|
|
my ($s, $ns) = $_->in_units(qw( |
|
223
|
|
|
|
|
|
|
seconds |
|
224
|
|
|
|
|
|
|
nanoseconds |
|
225
|
|
|
|
|
|
|
)); |
|
226
|
|
|
|
|
|
|
if ( int($ns) ) { |
|
227
|
|
|
|
|
|
|
$s = sprintf("%d.%09d", $s, $ns); |
|
228
|
|
|
|
|
|
|
$s =~ s/0+$//; |
|
229
|
|
|
|
|
|
|
} |
|
230
|
|
|
|
|
|
|
return sprintf('%sP%dY%dM%dDT%dH%dM%sS', |
|
231
|
|
|
|
|
|
|
$is_negative ? '-' : '', |
|
232
|
|
|
|
|
|
|
$_->in_units(qw( |
|
233
|
|
|
|
|
|
|
years |
|
234
|
|
|
|
|
|
|
months |
|
235
|
|
|
|
|
|
|
days |
|
236
|
|
|
|
|
|
|
hours |
|
237
|
|
|
|
|
|
|
minutes |
|
238
|
|
|
|
|
|
|
)), |
|
239
|
|
|
|
|
|
|
$s |
|
240
|
|
|
|
|
|
|
); |
|
241
|
|
|
|
|
|
|
}; |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
subtype 'xs:dateTime' => |
|
246
|
|
|
|
|
|
|
as 'Str' => |
|
247
|
|
|
|
|
|
|
where { /^\-?\d{4}\-\d{2}\-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?(?:[\-\+]\d{2}:?\d{2})?$/ }; |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
coerce 'xs:dateTime' |
|
250
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
251
|
|
|
|
|
|
|
via { |
|
252
|
|
|
|
|
|
|
my $datetime = $_->strftime( $_->nanosecond ? "%FT%T.%N" : "%FT%T"); |
|
253
|
|
|
|
|
|
|
$datetime =~ s/0+$// if $_->nanosecond; |
|
254
|
|
|
|
|
|
|
my $tz = $_->time_zone; |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
return $datetime if $tz->is_floating; |
|
257
|
|
|
|
|
|
|
return $datetime .'Z' if $tz->is_utc; |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
if ( DateTime::TimeZone->offset_as_string($_->offset) =~ |
|
260
|
|
|
|
|
|
|
/^([\+\-]\d{2})(\d{2})/ ) { |
|
261
|
|
|
|
|
|
|
return "$datetime$1:$2"; |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
return $datetime; |
|
264
|
|
|
|
|
|
|
}; |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
subtype 'xs:time' => |
|
269
|
|
|
|
|
|
|
as 'Str' => |
|
270
|
|
|
|
|
|
|
where { /^\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?(?:[\-\+]\d{2}:?\d{2})?$/ }; |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
coerce 'xs:time' |
|
273
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
274
|
|
|
|
|
|
|
via { |
|
275
|
|
|
|
|
|
|
my $time = $_->strftime( $_->nanosecond ? "%T.%N" : "%T"); |
|
276
|
|
|
|
|
|
|
$time =~ s/0+$// if $_->nanosecond; |
|
277
|
|
|
|
|
|
|
my $tz = $_->time_zone; |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
return $time if $tz->is_floating; |
|
280
|
|
|
|
|
|
|
return $time .'Z' if $tz->is_utc; |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
if ( DateTime::TimeZone->offset_as_string($_->offset) =~ |
|
283
|
|
|
|
|
|
|
/^([\+\-]\d{2})(\d{2})/ ) { |
|
284
|
|
|
|
|
|
|
return "$time$1:$2"; |
|
285
|
|
|
|
|
|
|
} |
|
286
|
|
|
|
|
|
|
return $time; |
|
287
|
|
|
|
|
|
|
}; |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
subtype 'xs:date' => |
|
292
|
|
|
|
|
|
|
as 'Str' => |
|
293
|
|
|
|
|
|
|
where { /^\-?\d{4}\-\d{2}\-\d{2}Z?(?:[\-\+]\d{2}:?\d{2})?$/ }; |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
coerce 'xs:date' |
|
296
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
297
|
|
|
|
|
|
|
via { |
|
298
|
|
|
|
|
|
|
my $date = $_->strftime("%F"); |
|
299
|
|
|
|
|
|
|
my $tz = $_->time_zone; |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
return $date if $tz->is_floating; |
|
302
|
|
|
|
|
|
|
return $date .'Z' if $tz->is_utc; |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
if ( DateTime::TimeZone->offset_as_string($_->offset) =~ |
|
305
|
|
|
|
|
|
|
/^([\+\-]\d{2})(\d{2})/ ) { |
|
306
|
|
|
|
|
|
|
return "$date$1:$2"; |
|
307
|
|
|
|
|
|
|
} |
|
308
|
|
|
|
|
|
|
return $date; |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
}; |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
subtype '__xs:IntPair' => |
|
315
|
|
|
|
|
|
|
as 'ArrayRef[Int]' => |
|
316
|
|
|
|
|
|
|
where { @$_ == 2 }; |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
subtype 'xs:gYearMonth' => |
|
320
|
|
|
|
|
|
|
as 'Str' => |
|
321
|
|
|
|
|
|
|
where { /^\d{4}\-\d{2}$/ }; |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
coerce 'xs:gYearMonth' |
|
324
|
|
|
|
|
|
|
=> from '__xs:IntPair' => |
|
325
|
|
|
|
|
|
|
via { |
|
326
|
|
|
|
|
|
|
return sprintf("%02d-%02d", @$_); |
|
327
|
|
|
|
|
|
|
} |
|
328
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
329
|
|
|
|
|
|
|
via { |
|
330
|
|
|
|
|
|
|
return $_->strftime("%Y-%m"); |
|
331
|
|
|
|
|
|
|
}; |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
subtype 'xs:gYear' => |
|
336
|
|
|
|
|
|
|
as 'Str' => |
|
337
|
|
|
|
|
|
|
where { /^\d{4}$/ }; |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
coerce 'xs:gYear' |
|
340
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
341
|
|
|
|
|
|
|
via { |
|
342
|
|
|
|
|
|
|
return $_->strftime("%Y"); |
|
343
|
|
|
|
|
|
|
}; |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
subtype 'xs:gMonthDay' => |
|
348
|
|
|
|
|
|
|
as 'Str' => |
|
349
|
|
|
|
|
|
|
where { /^\-\-\d{2}\-\d{2}$/ }; |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
coerce 'xs:gMonthDay' |
|
352
|
|
|
|
|
|
|
=> from '__xs:IntPair' => |
|
353
|
|
|
|
|
|
|
via { |
|
354
|
|
|
|
|
|
|
return sprintf("--%02d-%02d", @$_); |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
357
|
|
|
|
|
|
|
via { |
|
358
|
|
|
|
|
|
|
return $_->strftime("--%m-%d"); |
|
359
|
|
|
|
|
|
|
}; |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
subtype 'xs:gDay' => |
|
364
|
|
|
|
|
|
|
as 'Str' => |
|
365
|
|
|
|
|
|
|
where { /^\-\-\-\d{2}$/ }; |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
coerce 'xs:gDay' |
|
368
|
|
|
|
|
|
|
=> from 'Int' => |
|
369
|
|
|
|
|
|
|
via { |
|
370
|
|
|
|
|
|
|
return sprintf("---%02d", $_); |
|
371
|
|
|
|
|
|
|
} |
|
372
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
373
|
|
|
|
|
|
|
via { |
|
374
|
|
|
|
|
|
|
return $_->strftime("---%d"); |
|
375
|
|
|
|
|
|
|
}; |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
subtype 'xs:gMonth' => |
|
380
|
|
|
|
|
|
|
as 'Str' => |
|
381
|
|
|
|
|
|
|
where { $_ => /^\-\-\d{2}$/ }; |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
coerce 'xs:gMonth' |
|
384
|
|
|
|
|
|
|
=> from 'Int' => |
|
385
|
|
|
|
|
|
|
via { |
|
386
|
|
|
|
|
|
|
return sprintf("--%02d", $_); |
|
387
|
|
|
|
|
|
|
} |
|
388
|
|
|
|
|
|
|
=> from 'DateTime' => |
|
389
|
|
|
|
|
|
|
via { |
|
390
|
|
|
|
|
|
|
return $_->strftime("--%m"); |
|
391
|
|
|
|
|
|
|
}; |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
subtype 'xs:base64Binary' => |
|
396
|
|
|
|
|
|
|
as 'Str' => |
|
397
|
|
|
|
|
|
|
where { $_ =~ /^[a-zA-Z0-9=\+\/]+$/m }; |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
coerce 'xs:base64Binary' |
|
400
|
|
|
|
|
|
|
=> from 'IO::Handle' => |
|
401
|
|
|
|
|
|
|
via { |
|
402
|
|
|
|
|
|
|
local $/; |
|
403
|
|
|
|
|
|
|
my $content = <$_>; |
|
404
|
|
|
|
|
|
|
return encode_base64(encode("UTF-8", $content)); |
|
405
|
|
|
|
|
|
|
}; |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
subtype 'xs:anyURI' => |
|
410
|
|
|
|
|
|
|
as 'Str' => |
|
411
|
|
|
|
|
|
|
where { $_ =~ /^\w+:\/\/.*$/ }; |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
coerce 'xs:anyURI' |
|
414
|
|
|
|
|
|
|
=> from 'URI' => |
|
415
|
|
|
|
|
|
|
via { |
|
416
|
|
|
|
|
|
|
return $_->as_string; |
|
417
|
|
|
|
|
|
|
}; |
|
418
|
|
|
|
|
|
|
|
|
419
|
2
|
|
|
2
|
|
6378
|
no Moose::Util::TypeConstraints; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
25
|
|
|
420
|
2
|
|
|
2
|
|
407
|
no Moose; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
13
|
|
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
1; # End of MooseX::Types::XMLSchema |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
__END__ |
|
427
|
|
|
|
|
|
|
=pod |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=encoding utf-8 |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=head1 NAME |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
MooseX::Types::XMLSchema - XMLSchema compatible Moose types library |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=head1 VERSION |
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
version 0.06 |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
package My::Class; |
|
442
|
|
|
|
|
|
|
use Moose; |
|
443
|
|
|
|
|
|
|
use MooseX::Types::XMLSchema qw( :all ); |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
has 'string' => ( is => 'rw', isa => 'xs:string' ); |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
has 'boolean' => ( is => 'rw', isa => 'xs:boolean' ); |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
has 'byte' => ( is => 'rw', isa => 'xs:byte' ); |
|
450
|
|
|
|
|
|
|
has 'short' => ( is => 'rw', isa => 'xs:short' ); |
|
451
|
|
|
|
|
|
|
has 'int' => ( is => 'rw', isa => 'xs:int' ); |
|
452
|
|
|
|
|
|
|
has 'long' => ( is => 'rw', isa => 'xs:long', coerce => 1 ); |
|
453
|
|
|
|
|
|
|
has 'integer' => ( is => 'rw', isa => 'xs:integer', coerce => 1 ); |
|
454
|
|
|
|
|
|
|
has 'float' => ( is => 'rw', isa => 'xs:float', coerce => 1 ); |
|
455
|
|
|
|
|
|
|
has 'double' => ( is => 'rw', isa => 'xs:double', coerce => 1 ); |
|
456
|
|
|
|
|
|
|
has 'decimal' => ( is => 'rw', isa => 'xs:decimal', coerce => 1 ); |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
has 'duration' => ( is => 'rw', isa => 'xs:duration', coerce => 1 ); |
|
459
|
|
|
|
|
|
|
has 'datetime' => ( is => 'rw', isa => 'xs:dateTime', coerce => 1 ); |
|
460
|
|
|
|
|
|
|
has 'time' => ( is => 'rw', isa => 'xs:time', coerce => 1 ); |
|
461
|
|
|
|
|
|
|
has 'date' => ( is => 'rw', isa => 'xs:date', coerce => 1 ); |
|
462
|
|
|
|
|
|
|
has 'gYearMonth' => ( is => 'rw', isa => 'xs:gYearMonth', coerce => 1 ); |
|
463
|
|
|
|
|
|
|
has 'gYear' => ( is => 'rw', isa => 'xs:gYear', coerce => 1 ); |
|
464
|
|
|
|
|
|
|
has 'gMonthDay' => ( is => 'rw', isa => 'xs:gMonthDay', coerce => 1 ); |
|
465
|
|
|
|
|
|
|
has 'gDay' => ( is => 'rw', isa => 'xs:gDay', coerce => 1 ); |
|
466
|
|
|
|
|
|
|
has 'gMonth' => ( is => 'rw', isa => 'xs:gMonth', coerce => 1 ); |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
has 'base64Binary' => ( is => 'rw', isa => 'xs:base64Binary', coerce => 1 ); |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
has 'anyURI' => ( is => 'rw', isa => 'xs:anyURI', coerce => 1 ); |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
has 'nonPositiveInteger' => ( is => 'rw', isa => 'xs:nonPositiveInteger', coerce => 1 ); |
|
473
|
|
|
|
|
|
|
has 'positiveInteger' => ( is => 'rw', isa => 'xs:positiveInteger', coerce => 1 ); |
|
474
|
|
|
|
|
|
|
has 'nonNegativeInteger' => ( is => 'rw', isa => 'xs:nonNegativeInteger', coerce => 1 ); |
|
475
|
|
|
|
|
|
|
has 'negativeInteger' => ( is => 'rw', isa => 'xs:negativeInteger', coerce => 1 ); |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
has 'unsignedByte' => ( is => 'rw', isa => 'xs:unsignedByte' ); |
|
478
|
|
|
|
|
|
|
has 'unsignedShort' => ( is => 'rw', isa => 'xs:unsignedShort' ); |
|
479
|
|
|
|
|
|
|
has 'unsignedInt' => ( is => 'rw', isa => 'xs:unsignedInt' ); |
|
480
|
|
|
|
|
|
|
has 'unsignedLong' => ( is => 'rw', isa => 'xs:unsignedLong', coerce => 1 ); |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
Then, elsewhere: |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
my $object = My::Class->new( |
|
485
|
|
|
|
|
|
|
string => 'string', |
|
486
|
|
|
|
|
|
|
decimal => Math::BigFloat->new(20.12), |
|
487
|
|
|
|
|
|
|
duration => DateTime->now - DateTime->(year => 1990), |
|
488
|
|
|
|
|
|
|
base64Binary => IO::File->new($0), |
|
489
|
|
|
|
|
|
|
); |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
This class provides a number of XMLSchema compatible types for your Moose |
|
494
|
|
|
|
|
|
|
classes. |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=head1 TYPES |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=head2 xs:string |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
has 'string' => ( |
|
501
|
|
|
|
|
|
|
is => 'rw', |
|
502
|
|
|
|
|
|
|
isa => 'xs:string' |
|
503
|
|
|
|
|
|
|
); |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
A wrapper around built-in Str. |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
=head2 xs:integer |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
has 'integer' => ( |
|
510
|
|
|
|
|
|
|
is => 'rw', |
|
511
|
|
|
|
|
|
|
isa => 'xs:integer', |
|
512
|
|
|
|
|
|
|
coerce => 1 |
|
513
|
|
|
|
|
|
|
); |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
A L<Math::BigInt> object. Set to coerce from Int/Str. |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
This is defined in XSchema to be an arbitrary size integer. |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=head2 xs:positiveInteger |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
has 'positiveInteger' => ( |
|
522
|
|
|
|
|
|
|
is => 'rw', |
|
523
|
|
|
|
|
|
|
isa => 'xs:positiveInteger', |
|
524
|
|
|
|
|
|
|
coerce => 1, |
|
525
|
|
|
|
|
|
|
); |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
A L<Math::BigInt> object. Set to coerce from Int/Str. |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
This is defined in XSchema to be an arbitrary size integer greater than zero. |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=head2 xs:nonPositiveInteger |
|
532
|
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
has 'nonPositiveInteger' => ( |
|
534
|
|
|
|
|
|
|
is => 'rw', |
|
535
|
|
|
|
|
|
|
isa => 'xs:nonPositiveInteger', |
|
536
|
|
|
|
|
|
|
coerce => 1, |
|
537
|
|
|
|
|
|
|
); |
|
538
|
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
A L<Math::BigInt> object. Set to coerce from Int/Str. |
|
540
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
This is defined in XSchema to be an arbitrary size integer less than or equal |
|
542
|
|
|
|
|
|
|
to zero. |
|
543
|
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=head2 xs:negativeInteger |
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
has 'negativeInteger' => ( |
|
547
|
|
|
|
|
|
|
is => 'rw', |
|
548
|
|
|
|
|
|
|
isa => 'xs:negativeInteger', |
|
549
|
|
|
|
|
|
|
coerce => 1, |
|
550
|
|
|
|
|
|
|
); |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
A L<Math::BigInt> object. Set to coerce from Int/Str. |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
This is defined in XSchema to be an arbitrary size integer less than zero. |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=head2 xs:nonNegativeInteger |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
has 'nonPositiveInteger' => ( |
|
559
|
|
|
|
|
|
|
is => 'rw', |
|
560
|
|
|
|
|
|
|
isa => 'xs:nonNegativeInteger', |
|
561
|
|
|
|
|
|
|
coerce => 1, |
|
562
|
|
|
|
|
|
|
); |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
A L<Math::BigInt> object. Set to coerce from Int/Str. |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
This is defined in XSchema to be an arbitrary size integer greater than or |
|
567
|
|
|
|
|
|
|
equal to zero. |
|
568
|
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=head2 xs:long |
|
570
|
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
has 'long' => ( |
|
572
|
|
|
|
|
|
|
is => 'rw', |
|
573
|
|
|
|
|
|
|
isa => 'xs:long', |
|
574
|
|
|
|
|
|
|
coerce => 1, |
|
575
|
|
|
|
|
|
|
); |
|
576
|
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
A 64-bit Integer. Represented as a L<Math::Bigint> object, but limited to the |
|
578
|
|
|
|
|
|
|
64-bit (signed) range. Set to coerce from Int/Str. |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=head2 xs:unsignedLong |
|
581
|
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
has 'unsignedLong' => ( |
|
583
|
|
|
|
|
|
|
is => 'rw', |
|
584
|
|
|
|
|
|
|
isa => 'xs:unsignedLong', |
|
585
|
|
|
|
|
|
|
coerce => 1, |
|
586
|
|
|
|
|
|
|
); |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
A 64-bit Integer. Represented as a L<Math::Bigint> object, but limited to the |
|
589
|
|
|
|
|
|
|
64-bit (unsigned) range. Set to coerce from Int/Str. |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
=head2 xs:int |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
has 'int' => ( |
|
594
|
|
|
|
|
|
|
is => 'rw', |
|
595
|
|
|
|
|
|
|
isa => 'xs:int' |
|
596
|
|
|
|
|
|
|
); |
|
597
|
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
A 32-bit integer. Represented natively. |
|
599
|
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
=head2 xs:unsignedInt |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
has 'unsignedInt' => ( |
|
603
|
|
|
|
|
|
|
is => 'rw', |
|
604
|
|
|
|
|
|
|
isa => 'xs:unsignedInt' |
|
605
|
|
|
|
|
|
|
); |
|
606
|
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
A 32-bit integer. Represented natively. |
|
608
|
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=head2 xs:short |
|
610
|
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
has 'short' => ( |
|
612
|
|
|
|
|
|
|
is => 'rw', |
|
613
|
|
|
|
|
|
|
isa => 'xs:short' |
|
614
|
|
|
|
|
|
|
); |
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
A 16-bit integer. Represented natively. |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=head2 xs:unsignedShort |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
has 'unsignedShort' => ( |
|
621
|
|
|
|
|
|
|
is => 'rw', |
|
622
|
|
|
|
|
|
|
isa => 'xs:unsignedShort' |
|
623
|
|
|
|
|
|
|
); |
|
624
|
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
A 16-bit integer. Represented natively. |
|
626
|
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
=head2 xs:byte |
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
has 'byte' => ( |
|
630
|
|
|
|
|
|
|
is => 'rw', |
|
631
|
|
|
|
|
|
|
isa => 'xs:byte' |
|
632
|
|
|
|
|
|
|
); |
|
633
|
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
An 8-bit integer. Represented natively. |
|
635
|
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=head2 xs:unsignedByte |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
has 'unsignedByte' => ( |
|
639
|
|
|
|
|
|
|
is => 'rw', |
|
640
|
|
|
|
|
|
|
isa => 'xs:unsignedByte' |
|
641
|
|
|
|
|
|
|
); |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
An 8-bit integer. Represented natively. |
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
=head2 xs:boolean |
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
has 'boolean' => ( |
|
648
|
|
|
|
|
|
|
is => 'rw', |
|
649
|
|
|
|
|
|
|
isa => 'xs:boolean' |
|
650
|
|
|
|
|
|
|
); |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
A wrapper around built-in Bool. |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=head2 xs:float |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
has 'float' => ( |
|
657
|
|
|
|
|
|
|
is => 'rw', |
|
658
|
|
|
|
|
|
|
isa => 'xs:float', |
|
659
|
|
|
|
|
|
|
coerce => 1, |
|
660
|
|
|
|
|
|
|
); |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
A single-precision 32-bit Float. Represented as a L<Math::BigFloat> object, but limited to the |
|
663
|
|
|
|
|
|
|
32-bit range. Set to coerce from Num/Str. |
|
664
|
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=head2 xs:double |
|
666
|
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
has 'double' => ( |
|
668
|
|
|
|
|
|
|
is => 'rw', |
|
669
|
|
|
|
|
|
|
isa => 'xs:double', |
|
670
|
|
|
|
|
|
|
coerce => 1, |
|
671
|
|
|
|
|
|
|
); |
|
672
|
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
A double-precision 64-bit Float. Represented as a L<Math::BigFloat> object, but limited to the |
|
674
|
|
|
|
|
|
|
64-bit range. Set to coerce from Num/Str. |
|
675
|
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=head2 xs:decimal |
|
677
|
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
has 'decimal' => ( |
|
679
|
|
|
|
|
|
|
is => 'rw', |
|
680
|
|
|
|
|
|
|
isa => 'xs:decimal', |
|
681
|
|
|
|
|
|
|
coerce => 1, |
|
682
|
|
|
|
|
|
|
); |
|
683
|
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
Any base-10 fixed-point number. Represented as a L<Math::BigFloat> object. Set to coerce from Num/Str. |
|
685
|
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
=head2 xs:duration |
|
687
|
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
has 'duration' => ( |
|
689
|
|
|
|
|
|
|
is => 'rw', |
|
690
|
|
|
|
|
|
|
isa => 'xs:duration', |
|
691
|
|
|
|
|
|
|
coerce => 1, |
|
692
|
|
|
|
|
|
|
); |
|
693
|
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
A wrapper around Str. |
|
695
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime::Duration object. |
|
696
|
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
=head2 xs:dateTime |
|
698
|
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
has 'datetime' => ( |
|
700
|
|
|
|
|
|
|
is => 'rw', |
|
701
|
|
|
|
|
|
|
isa => 'xs:dateTime', |
|
702
|
|
|
|
|
|
|
coerce => 1 |
|
703
|
|
|
|
|
|
|
); |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
A wrapper around Str. |
|
706
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object. |
|
707
|
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
=head2 xs:time |
|
709
|
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
has 'time' => ( |
|
711
|
|
|
|
|
|
|
is => 'rw', |
|
712
|
|
|
|
|
|
|
isa => 'xs:time', |
|
713
|
|
|
|
|
|
|
coerce => 1 |
|
714
|
|
|
|
|
|
|
); |
|
715
|
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
A wrapper around Str. |
|
717
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object. |
|
718
|
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
=head2 xs:date |
|
720
|
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
has 'date' => ( |
|
722
|
|
|
|
|
|
|
is => 'rw', |
|
723
|
|
|
|
|
|
|
isa => 'xs:date', |
|
724
|
|
|
|
|
|
|
coerce => 1 |
|
725
|
|
|
|
|
|
|
); |
|
726
|
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
A wrapper around Str. |
|
728
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object. |
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=head2 xs:gYearMonth |
|
731
|
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
has 'gYearMonth' => ( |
|
733
|
|
|
|
|
|
|
is => 'rw', |
|
734
|
|
|
|
|
|
|
isa => 'xs:gYearMonth', |
|
735
|
|
|
|
|
|
|
coerce => 1 |
|
736
|
|
|
|
|
|
|
); |
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
A wrapper around Str. |
|
739
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object or a ArrayRef of two |
|
740
|
|
|
|
|
|
|
integers. |
|
741
|
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=head2 xs:gYear |
|
743
|
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
has 'gYear' => ( |
|
745
|
|
|
|
|
|
|
is => 'rw', |
|
746
|
|
|
|
|
|
|
isa => 'xs:gYear', |
|
747
|
|
|
|
|
|
|
coerce => 1 |
|
748
|
|
|
|
|
|
|
); |
|
749
|
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
A wrapper around Str. |
|
751
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object. |
|
752
|
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
=head2 xs:gMonthDay |
|
754
|
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
has 'gMonthDay' => ( |
|
756
|
|
|
|
|
|
|
is => 'rw', |
|
757
|
|
|
|
|
|
|
isa => 'xs:gMonthDay', |
|
758
|
|
|
|
|
|
|
coerce => 1 |
|
759
|
|
|
|
|
|
|
); |
|
760
|
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
A wrapper around Str. |
|
762
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object or a ArrayRef of two |
|
763
|
|
|
|
|
|
|
integers. |
|
764
|
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
=head2 xs:gDay |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
has 'gDay' => ( |
|
768
|
|
|
|
|
|
|
is => 'rw', |
|
769
|
|
|
|
|
|
|
isa => 'xs:gDay', |
|
770
|
|
|
|
|
|
|
coerce => 1 |
|
771
|
|
|
|
|
|
|
); |
|
772
|
|
|
|
|
|
|
|
|
773
|
|
|
|
|
|
|
A wrapper around Str. |
|
774
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object or Int eg. 24. |
|
775
|
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=head2 xs:gMonth |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
has 'gMonth' => ( |
|
779
|
|
|
|
|
|
|
is => 'rw', |
|
780
|
|
|
|
|
|
|
isa => 'xs:gMonth', |
|
781
|
|
|
|
|
|
|
coerce => 1 |
|
782
|
|
|
|
|
|
|
); |
|
783
|
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
A wrapper around Str. |
|
785
|
|
|
|
|
|
|
If you enable coerce you can pass a DateTime object or Int eg. 10. |
|
786
|
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
=head2 xs:base64Binary |
|
788
|
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
has 'base64Binary' => ( |
|
790
|
|
|
|
|
|
|
is => 'rw', |
|
791
|
|
|
|
|
|
|
isa => 'xs:base64Binary', |
|
792
|
|
|
|
|
|
|
coerce => 1 |
|
793
|
|
|
|
|
|
|
); |
|
794
|
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
A wrapper around Str. |
|
796
|
|
|
|
|
|
|
If you enable coerce you can pass a IO::Handle object - the content of the |
|
797
|
|
|
|
|
|
|
file will be encoded to UTF-8 before encoding with base64. |
|
798
|
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
=head2 xs:anyURI |
|
800
|
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
has 'anyURI' => ( |
|
802
|
|
|
|
|
|
|
is => 'rw', |
|
803
|
|
|
|
|
|
|
isa => 'xs:anyURI', |
|
804
|
|
|
|
|
|
|
coerce => 1 |
|
805
|
|
|
|
|
|
|
); |
|
806
|
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
A wrapper around Str. |
|
808
|
|
|
|
|
|
|
If you enable coerce you can pass a URI object. |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
811
|
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
=over 4 |
|
813
|
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
=item * Enable attributes coercion automatically with |
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
L<MooseX::AlwaysCoerce> |
|
817
|
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
=back |
|
819
|
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
=head1 AUTHOR |
|
821
|
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
Alex J. G. BurzyÅski <ajgb@cpan.org> |
|
823
|
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
825
|
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Alex J. G. BurzyÅski <ajgb@cpan.org>. |
|
827
|
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
829
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
830
|
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
=cut |
|
832
|
|
|
|
|
|
|
|