| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
4
|
|
|
4
|
|
888653
|
use 5.008; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
129
|
|
|
2
|
4
|
|
|
4
|
|
17
|
use strict; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
91
|
|
|
3
|
4
|
|
|
4
|
|
14
|
use warnings; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
193
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Types::URI; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
8
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
2088
|
use URI; |
|
|
4
|
|
|
|
|
15536
|
|
|
|
4
|
|
|
|
|
102
|
|
|
11
|
4
|
|
|
4
|
|
1741
|
use URI::file; |
|
|
4
|
|
|
|
|
16692
|
|
|
|
4
|
|
|
|
|
94
|
|
|
12
|
4
|
|
|
4
|
|
1634
|
use URI::data; |
|
|
4
|
|
|
|
|
6747
|
|
|
|
4
|
|
|
|
|
92
|
|
|
13
|
4
|
|
|
4
|
|
1737
|
use URI::WithBase; |
|
|
4
|
|
|
|
|
2489
|
|
|
|
4
|
|
|
|
|
88
|
|
|
14
|
4
|
|
|
4
|
|
1779
|
use URI::FromHash; |
|
|
4
|
|
|
|
|
25943
|
|
|
|
4
|
|
|
|
|
191
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
4
|
|
|
4
|
|
1442
|
use Type::Library -base, -declare => qw( Uri FileUri DataUri Iri ); |
|
|
4
|
|
|
|
|
60200
|
|
|
|
4
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
4
|
|
|
4
|
|
4379
|
use Types::Path::Tiny qw( Path ); |
|
|
4
|
|
|
|
|
209381
|
|
|
|
4
|
|
|
|
|
38
|
|
|
19
|
4
|
|
|
4
|
|
1477
|
use Types::Standard qw( InstanceOf ScalarRef HashRef Str ); |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
22
|
|
|
20
|
4
|
|
|
4
|
|
4726
|
use Types::UUID qw( Uuid ); |
|
|
4
|
|
|
|
|
86322
|
|
|
|
4
|
|
|
|
|
40
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $TrineNode = InstanceOf['RDF::Trine::Node::Resource']; |
|
23
|
|
|
|
|
|
|
my $TrineNS = InstanceOf['RDF::Trine::Namespace']; |
|
24
|
|
|
|
|
|
|
my $XmlNS = InstanceOf['XML::Namespace']; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type({ |
|
27
|
|
|
|
|
|
|
name => Iri, |
|
28
|
|
|
|
|
|
|
parent => InstanceOf['IRI'], |
|
29
|
|
|
|
|
|
|
# Need to define coercions below to break circularity of |
|
30
|
|
|
|
|
|
|
# Uri and Iri. |
|
31
|
|
|
|
|
|
|
}); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type({ |
|
34
|
|
|
|
|
|
|
name => Uri, |
|
35
|
|
|
|
|
|
|
parent => InstanceOf[qw/ URI URI::WithBase /], |
|
36
|
|
|
|
|
|
|
coercion => [ |
|
37
|
|
|
|
|
|
|
Uuid ,=> q{ "URI"->new("urn:uuid:$_") }, |
|
38
|
|
|
|
|
|
|
Str ,=> q{ "URI"->new($_) }, |
|
39
|
|
|
|
|
|
|
Path ,=> q{ "URI::file"->new($_) }, |
|
40
|
|
|
|
|
|
|
ScalarRef ,=> q{ do { my $u = "URI"->new("data:"); $u->data($$_); $u } }, |
|
41
|
|
|
|
|
|
|
HashRef ,=> q{ "URI"->new(URI::FromHash::uri(%$_)) }, |
|
42
|
|
|
|
|
|
|
$TrineNode ,=> q{ "URI"->new($_->uri_value) }, |
|
43
|
|
|
|
|
|
|
$TrineNS ,=> q{ "URI"->new($_->uri->uri_value) }, |
|
44
|
|
|
|
|
|
|
$XmlNS ,=> q{ "URI"->new($_->uri) }, |
|
45
|
|
|
|
|
|
|
Iri ,=> q{ "URI"->new($_->as_string) }, |
|
46
|
|
|
|
|
|
|
], |
|
47
|
|
|
|
|
|
|
}); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Iri->coercion->add_type_coercions( |
|
50
|
|
|
|
|
|
|
Uuid ,=> q{ do { require IRI; "IRI"->new("urn:uuid:$_") } }, |
|
51
|
|
|
|
|
|
|
Str ,=> q{ do { require IRI; "IRI"->new($_) } }, |
|
52
|
|
|
|
|
|
|
Path ,=> q{ do { require IRI; my $u = "URI::file"->new($_); "IRI"->new($u->as_string) } }, |
|
53
|
|
|
|
|
|
|
ScalarRef ,=> q{ do { require IRI; my $u = "URI"->new("data:"); $u->data($$_); "IRI"->new($u->as_string) } }, |
|
54
|
|
|
|
|
|
|
HashRef ,=> q{ do { require IRI; "IRI"->new(URI::FromHash::uri(%$_)) } }, |
|
55
|
|
|
|
|
|
|
$TrineNode ,=> q{ do { require IRI; "IRI"->new($_->uri_value) } }, |
|
56
|
|
|
|
|
|
|
$TrineNS ,=> q{ do { require IRI; "IRI"->new($_->uri->uri_value) } }, |
|
57
|
|
|
|
|
|
|
$XmlNS ,=> q{ do { require IRI; "IRI"->new($_->uri) } }, |
|
58
|
|
|
|
|
|
|
Uri ,=> q{ do { require IRI; "IRI"->new($_->as_string) } }, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type({ |
|
62
|
|
|
|
|
|
|
name => FileUri, |
|
63
|
|
|
|
|
|
|
parent => Uri, |
|
64
|
|
|
|
|
|
|
constraint => sub { $_->isa('URI::file') }, |
|
65
|
|
|
|
|
|
|
inlined => sub { InstanceOf->parameterize('URI::file')->inline_check($_[1]) }, |
|
66
|
|
|
|
|
|
|
coercion => [ |
|
67
|
|
|
|
|
|
|
Str ,=> q{ "URI::file"->new($_) }, |
|
68
|
|
|
|
|
|
|
Path ,=> q{ "URI::file"->new($_) }, |
|
69
|
|
|
|
|
|
|
HashRef ,=> q{ "URI"->new(URI::FromHash::uri(%$_)) }, |
|
70
|
|
|
|
|
|
|
$TrineNode ,=> q{ "URI"->new($_->uri_value) }, |
|
71
|
|
|
|
|
|
|
$TrineNS ,=> q{ "URI"->new($_->uri->uri_value) }, |
|
72
|
|
|
|
|
|
|
$XmlNS ,=> q{ "URI"->new($_->uri) }, |
|
73
|
|
|
|
|
|
|
Iri ,=> q{ "URI"->new($_->as_string) }, |
|
74
|
|
|
|
|
|
|
], |
|
75
|
|
|
|
|
|
|
}); |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__PACKAGE__->meta->add_type({ |
|
78
|
|
|
|
|
|
|
name => DataUri, |
|
79
|
|
|
|
|
|
|
parent => Uri, |
|
80
|
|
|
|
|
|
|
constraint => sub { $_->isa('URI::data') }, |
|
81
|
|
|
|
|
|
|
inlined => sub { InstanceOf->parameterize('URI::data')->inline_check($_[1]) }, |
|
82
|
|
|
|
|
|
|
coercion => [ |
|
83
|
|
|
|
|
|
|
Str ,=> q{ do { my $u = "URI"->new("data:"); $u->data($_); $u } }, |
|
84
|
|
|
|
|
|
|
ScalarRef ,=> q{ do { my $u = "URI"->new("data:"); $u->data($$_); $u } }, |
|
85
|
|
|
|
|
|
|
HashRef ,=> q{ "URI"->new(URI::FromHash::uri(%$_)) }, |
|
86
|
|
|
|
|
|
|
$TrineNode ,=> q{ "URI"->new($_->uri_value) }, |
|
87
|
|
|
|
|
|
|
$TrineNS ,=> q{ "URI"->new($_->uri->uri_value) }, |
|
88
|
|
|
|
|
|
|
$XmlNS ,=> q{ "URI"->new($_->uri) }, |
|
89
|
|
|
|
|
|
|
Iri ,=> q{ "URI"->new($_->as_string) }, |
|
90
|
|
|
|
|
|
|
], |
|
91
|
|
|
|
|
|
|
}); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; # returns true |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=pod |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=encoding utf-8 |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Types::URI - type constraints and coercions for URIs |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
package FroobleDocument; |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
use Moose; |
|
110
|
|
|
|
|
|
|
use Types::URI -all; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has source => ( |
|
113
|
|
|
|
|
|
|
is => 'ro', |
|
114
|
|
|
|
|
|
|
isa => Uri, |
|
115
|
|
|
|
|
|
|
coerce => 1, |
|
116
|
|
|
|
|
|
|
); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L<Types::URI> is a type constraint library suitable for use with |
|
121
|
|
|
|
|
|
|
L<Moo>/L<Moose> attributes, L<Kavorka> sub signatures, and so forth. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 Types |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This module provides some type constraints broadly compatible with |
|
126
|
|
|
|
|
|
|
those provided by L<MooseX::Types::URI>, plus a couple of extra type |
|
127
|
|
|
|
|
|
|
constraints. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=over |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item C<Uri> |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
A class type for L<URI>/L<URI::WithBase>. Coercions from: |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=over |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item from C<Uuid> |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Coerces to a URI in the C<< urn:uuid: >> schema. (See L<Types::UUID>.) |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item from C<Str> |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Uses L<URI/new>. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item from C<Path> |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Uses L<URI::file/new>. (See L<Types::Path::Tiny>.) |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item from C<ScalarRef> |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Uses L<URI::data/new>. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item from C<HashRef> |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Coerces using L<URI::FromHash>. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item from C<Iri> |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Uses L<URI/new>. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item from L<RDF::Trine::Node::Resource>, L<RDF::Trine::Namespace>, L<XML::Namespace> |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Uses L<URI/new>. |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=back |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item C<FileUri> |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
A subtype of C<Uri> covering L<URI::file>. Coercions from: |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=over |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item from C<Str> |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Uses L<URI::file/new>. |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item from C<Path> |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Uses L<URI::file/new>. (See L<Types::Path::Tiny>.) |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=item from C<HashRef> |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Coerces using L<URI::FromHash>. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item from C<Iri> |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Uses L<URI/new>. |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item from L<RDF::Trine::Node::Resource>, L<RDF::Trine::Namespace>, L<XML::Namespace> |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Uses L<URI/new>. |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=back |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item C<DataUri> |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
A subtype of C<Uri> covering L<URI::data>. Coercions from: |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=over |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item from C<Str> |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Uses L<URI::data/new>. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item from C<ScalarRef> |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Uses L<URI::data/new>. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item from C<HashRef> |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Coerces using L<URI::FromHash>. |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item from C<Iri> |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Uses L<URI/new>. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item from L<RDF::Trine::Node::Resource>, L<RDF::Trine::Namespace>, L<XML::Namespace> |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Uses L<URI/new>. |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=item C<Iri> |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
A class type for L<IRI>. Coercions as per C<Uri> above, plus can coerce |
|
226
|
|
|
|
|
|
|
from C<Uri>. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=back |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 BUGS |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Please report any bugs to |
|
233
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=Types-URI>. |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
L<MooseX::Types::URI>, |
|
238
|
|
|
|
|
|
|
L<Type::Tiny::Manual>, |
|
239
|
|
|
|
|
|
|
L<URI>, |
|
240
|
|
|
|
|
|
|
L<URI::file>, |
|
241
|
|
|
|
|
|
|
L<URI::data>, |
|
242
|
|
|
|
|
|
|
L<URI::FromHash>, |
|
243
|
|
|
|
|
|
|
L<RDF::Trine::Node::Resource>, |
|
244
|
|
|
|
|
|
|
L<IRI>. |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
L<Types::UUID>, |
|
247
|
|
|
|
|
|
|
L<Types::Path::Tiny>, |
|
248
|
|
|
|
|
|
|
L<Types::Standard>. |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 AUTHOR |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Toby Inkster. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
259
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
|
264
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
|
265
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
|
266
|
|
|
|
|
|
|
|