NAME

URI::NamespaceMap::ReservedLocalParts - Permissible local parts for NamespaceMap

VERSION

Version 1.08

SYNOPSIS

    my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]);

    say $r->is_reserved('isa'); # 1
    say $r->is_reserved('uri'); # 1
    say $r->is_reserved('foo'); # 0

DESCRIPTION

URI::NamespaceMap::ReservedLocalParts is an accompanying distribution to URI::NamespaceMap. It's goal is to check for forbidden names used for local parts.

Rather than creating a blacklist that needs to be maintained, it instantiates a new Moo object, and calls can on the invocant. Using this technique, it means that every method on every Perl object (isa, can, VERSION), and Moo objects (BUILD, BUILDARGS) will be automatically black listed.

ATTRIBUTES

URI::NamespaceMap::ReservedLocalParts implements the following attributes.

allowed

A whitelist of local part names. Defaults to allowed, disallowed and is_reserved so that when can is called on the instance, it doesn't return a false positive for other method names associated with this package.

disallowed

A blacklist of local part names. Does not have a default set, but usually defaults to uri when called from URI::NamespaceMap.

METHODS

URI::NamespaceMap::ReservedLocalParts implements the following methods.

is_reserved

    my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]);

    say $r->is_reserved('isa'); # 1
    say $r->is_reserved('uri'); # 1
    say $r->is_reserved('foo'); # 0

Checks if the first argument passed is reserved or not. Returns a boolean.

FURTHER DETAILS

See URI::NamespaceMap for further details about authors, license, etc.