1URI::Namespace(3) User Contributed Perl Documentation URI::Namespace(3)
2
3
4
6 URI::Namespace - A namespace URI/IRI class with autoload methods
7
9 use URI::Namespace;
10 my $foaf = URI::Namespace->new( 'http://xmlns.com/foaf/0.1/' );
11 print $foaf->as_string;
12 print $foaf->name;
13
15 This module provides an object with a URI/IRI attribute, typically used
16 prefix-namespace pairs, typically used in XML, RDF serializations, etc.
17 The local part can be used as a method, these are autoloaded.
18
20 "new ( $string | URI | IRI )"
21 This is the constructor. You may pass a string with a URI or a URI
22 object.
23
24 "uri ( [ $local_part ] )"
25 Returns a URI object with the namespace IRI. Optionally, the method
26 can take a local part as argument, in which case, it will return
27 the namespace URI with the local part appended.
28
29 "iri ( [ $local_part ] )"
30 Returns a IRI object with the namespace IRI. Optionally, the method
31 can take a local part as argument, in which case, it will return
32 the namespace IRI with the local part appended.
33
34 "local_part ( $uri )"
35 Returns the local part string if the given argument URI (which may
36 be a string, URI or IRI object) matches the namespace URI, or
37 "undef" if not.
38
39 The following methods from URI can be used on an URI::Namespace object:
40 "as_string", "as_iri", "canonical", "eq", "abs", "rel".
41
42 One important usage for this module is to enable you to create URIs for
43 full URIs, e.g.:
44
45 print $foaf->Person->as_string;
46
47 will return
48
49 http://xmlns.com/foaf/0.1/Person
50
52 See URI::NamespaceMap for further details about authors, license, etc.
53
54
55
56perl v5.28.1 2019-04-15 URI::Namespace(3)