line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Types::Namespace; |
2
|
6
|
|
|
6
|
|
491477
|
use strict; |
|
6
|
|
|
|
|
31
|
|
|
6
|
|
|
|
|
266
|
|
3
|
6
|
|
|
6
|
|
35
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
353
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
862
|
use Type::Library -base, -declare => qw( Uri Iri Namespace NamespaceMap ); |
|
6
|
|
|
|
|
27499
|
|
|
6
|
|
|
|
|
65
|
|
6
|
6
|
|
|
6
|
|
6820
|
use Types::Standard qw( HashRef InstanceOf ); |
|
6
|
|
|
|
|
53271
|
|
|
6
|
|
|
|
|
54
|
|
7
|
6
|
|
|
6
|
|
7863
|
use Types::URI qw(); |
|
6
|
|
|
|
|
617285
|
|
|
6
|
|
|
|
|
1799
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $HalUri = InstanceOf['Data::HAL::URI']; |
10
|
|
|
|
|
|
|
my $AtteanIRI = InstanceOf['Attean::IRI']; |
11
|
|
|
|
|
|
|
my $TrineNS = InstanceOf['RDF::Trine::Namespace']; |
12
|
|
|
|
|
|
|
my $TrineNSMap = InstanceOf['RDF::Trine::NamespaceMap']; |
13
|
|
|
|
|
|
|
my $TrineNode = InstanceOf['RDF::Trine::Node::Resource']; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '1.09_03'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Types::Namespace - type constraints for dealing with namespaces |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package Namespace::Counter { |
24
|
|
|
|
|
|
|
use Moo; # or Moose |
25
|
|
|
|
|
|
|
use Types::Namespace qw( Namespace ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has ns => ( |
28
|
|
|
|
|
|
|
is => "ro", |
29
|
|
|
|
|
|
|
isa => Namespace, |
30
|
|
|
|
|
|
|
required => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub count_uses_in_document { ... } |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Types::Namespace is a type constraint library suitable for use with |
39
|
|
|
|
|
|
|
L<Moo>/L<Moose> attributes, L<Kavorka> sub signatures, and so |
40
|
|
|
|
|
|
|
forth. It builds on L<Types::URI>. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 TYPES |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item C<< Namespace >> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
A class type for L<URI::Namespace>. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Can coerce from L<URI>, L<IRI>, L<Path::Tiny>, L<Attean::IRI>, |
51
|
|
|
|
|
|
|
L<RDF::Trine::Namespace>, L<RDF::Trine::Node::Resource> and strings. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item C<< NamespaceMap >> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
A class type for L<URI::NamespaceMap>. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Can coerce from a hashref of C<< prefix => URI >> pairs and from |
58
|
|
|
|
|
|
|
L<RDF::Trine::NamespaceMap>. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item C<< Uri >>, C<< Iri >> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
These namespaces are re-exported from L<Types::URI>, but with an |
63
|
|
|
|
|
|
|
additional coercion from the C<< Namespace >> type. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=back |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 FURTHER DETAILS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
See L<URI::NamespaceMap> for further details about authors, license, etc. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__PACKAGE__->add_type( |
74
|
|
|
|
|
|
|
name => Uri, |
75
|
|
|
|
|
|
|
parent => Types::URI::Uri, |
76
|
|
|
|
|
|
|
coercion => [ |
77
|
|
|
|
|
|
|
@{ Types::URI::Uri->coercion->type_coercion_map }, |
78
|
|
|
|
|
|
|
InstanceOf['URI::Namespace'] ,=> q{ $_->uri() }, |
79
|
|
|
|
|
|
|
], |
80
|
|
|
|
|
|
|
); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__PACKAGE__->add_type( |
83
|
|
|
|
|
|
|
name => Iri, |
84
|
|
|
|
|
|
|
parent => Types::URI::Iri, |
85
|
|
|
|
|
|
|
coercion => [ |
86
|
|
|
|
|
|
|
@{ Types::URI::Iri->coercion->type_coercion_map }, |
87
|
|
|
|
|
|
|
InstanceOf['URI::Namespace'] ,=> q{ $_->iri() }, |
88
|
|
|
|
|
|
|
], |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__PACKAGE__->add_type( |
92
|
|
|
|
|
|
|
name => Namespace, |
93
|
|
|
|
|
|
|
parent => InstanceOf['URI::Namespace'], |
94
|
|
|
|
|
|
|
coercion => [ |
95
|
|
|
|
|
|
|
Iri->coercibles ,=> q{ "URI::Namespace"->new($_) }, |
96
|
|
|
|
|
|
|
$AtteanIRI ,=> q{ "URI::Namespace"->new($_->as_string) }, |
97
|
|
|
|
|
|
|
$HalUri ,=> q{ "URI::Namespace"->new($_->as_string) }, |
98
|
|
|
|
|
|
|
$TrineNode ,=> q{ "URI::Namespace"->new($_->as_string) }, |
99
|
|
|
|
|
|
|
$TrineNS ,=> q{ "URI::Namespace"->new($_->as_string) }, |
100
|
|
|
|
|
|
|
], |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__PACKAGE__->add_type( |
104
|
|
|
|
|
|
|
name => NamespaceMap, |
105
|
|
|
|
|
|
|
parent => InstanceOf['URI::NamespaceMap'], |
106
|
|
|
|
|
|
|
coercion => [ |
107
|
|
|
|
|
|
|
HashRef ,=> q{ "URI::NamespaceMap"->new(namespace_map => $_) }, |
108
|
|
|
|
|
|
|
$TrineNSMap ,=> q{ do { my $map = $_; my %hash = map { $_ => $map->namespace_uri($_)->uri_value } $map->list_prefixes ; "URI::NamespaceMap"->new(namespace_map => \%hash) } } |
109
|
|
|
|
|
|
|
], |
110
|
|
|
|
|
|
|
); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
require URI::Namespace; |
113
|
|
|
|
|
|
|
require URI::NamespaceMap; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |