1Types::Namespace(3) User Contributed Perl Documentation Types::Namespace(3)
2
3
4
6 Types::Namespace - type constraints for dealing with namespaces
7
9 package Namespace::Counter {
10 use Moo; # or Moose
11 use Types::Namespace qw( Namespace );
12
13 has ns => (
14 is => "ro",
15 isa => Namespace,
16 required => 1,
17 );
18
19 sub count_uses_in_document { ... }
20 }
21
23 Types::Namespace is a type constraint library suitable for use with
24 Moo/Moose attributes, Kavorka sub signatures, and so forth. It builds
25 on Types::URI.
26
28 "Namespace"
29 A class type for URI::Namespace.
30
31 Can coerce from URI, IRI, Path::Tiny, Attean::IRI,
32 RDF::Trine::Namespace, RDF::Trine::Node::Resource and strings.
33
34 "NamespaceMap"
35 A class type for URI::NamespaceMap.
36
37 Can coerce from a hashref of "prefix => URI" pairs and from
38 RDF::Trine::NamespaceMap.
39
40 "Uri", "Iri"
41 These namespaces are re-exported from Types::URI, but with an
42 additional coercion from the "Namespace" type.
43
45 See URI::NamespaceMap for further details about authors, license, etc.
46
47
48
49perl v5.36.0 2023-01-20 Types::Namespace(3)