1URI::NamespaceMap::ReseUrsveerdLCoocnatlrPiabruttse(d3U)PReIr:l:NDaomceusmpeancteaMtaipo:n:ReservedLocalParts(3)
2
3
4
6 URI::NamespaceMap::ReservedLocalParts - Permissible local parts for
7 NamespaceMap
8
10 Version 1.10
11
13 my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]);
14
15 say $r->is_reserved('isa'); # 1
16 say $r->is_reserved('uri'); # 1
17 say $r->is_reserved('foo'); # 0
18
20 URI::NamespaceMap::ReservedLocalParts is an accompanying distribution
21 to URI::NamespaceMap. It's goal is to check for forbidden names used
22 for local parts.
23
24 Rather than creating a blacklist that needs to be maintained, it
25 instantiates a new Moo object, and calls "can" on the invocant. Using
26 this technique, it means that every method on every Perl object ("isa,
27 can, VERSION"), and Moo objects ("BUILD, BUILDARGS") will be
28 automatically black listed.
29
31 URI::NamespaceMap::ReservedLocalParts implements the following
32 attributes.
33
34 allowed
35 A whitelist of local part names. Defaults to "allowed", "disallowed"
36 and "is_reserved" so that when "can" is called on the instance, it
37 doesn't return a false positive for other method names associated with
38 this package.
39
40 disallowed
41 A blacklist of local part names. Does not have a default set, but
42 usually defaults to "uri" when called from URI::NamespaceMap.
43
45 URI::NamespaceMap::ReservedLocalParts implements the following methods.
46
47 is_reserved
48 my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]);
49
50 say $r->is_reserved('isa'); # 1
51 say $r->is_reserved('uri'); # 1
52 say $r->is_reserved('foo'); # 0
53
54 Checks if the first argument passed is reserved or not. Returns a
55 "boolean".
56
58 See URI::NamespaceMap for further details about authors, license, etc.
59
60
61
62perl v5.32.1 2021-U0R1I-:2:7NamespaceMap::ReservedLocalParts(3)