Articulate::LocationSpecification - represent a specification
new_location_specification ['zone', '*', 'article', 'hello-world'] new_location_specification 'zone/*/article/hello-world' # same thing
An object class which represents a specification - like a 'pattern' or 'glob', and provides methods so that it can be compared with locations. It is similar to Articulate::Location, and stringifies to the 'file path' representation.
Articulate::Location
The main use of this is to determine whether a user has access to a resource based on rules (e.g. Articulate::Authorisation::LocationBased).
new_location_specification is a constructor. It takes either a string (in the form of a path) or an arrayref. Either will be stored as an arrayref in the path attribute.
new_location_specification
path
An arrayref representing the path to the location specification. This is used for overloaded array dereferencing.
$locspec->location->location # same as $locspec
This method always returns the object itself.
Joins the contents of path on / and returns the result. This is used for overloaded stringification.
/
new_location_specification('/zone/*')->matches(new_location('/zone/public')) # true new_location_specification('/zone/*')->matches(new_location('/')) # false new_location_specification('/zone/*')->matches(new_location('/zone/public/article/hello-world')) # false
Determines if the location given as the first argument matches the locspec.
new_location_specification('/zone/*')->matches_ancestor_of(new_location('/zone/public')) # true new_location_specification('/zone/*')->matches_ancestor_of(new_location('/')) # false new_location_specification('/zone/*')->matches_ancestor_of(new_location('/zone/public/article/hello-world')) # true
Determines if the location given as the first argument - or any ancestor thereof - matches the new_location_specification.
new_location_specification('/zone/*')->matches_descendant_of(new_location('/zone/public')) # true new_location_specification('/zone/*')->matches_descendant_of(new_location('/')) # true new_location_specification('/zone/*')->matches_descendant_of(new_location('/zone/public/article/hello-world')) # false
Determines if the location given as the first argument - or any descendant thereof - matches the new_location_specification.
Articulate::Navigation
Articulate::Permission
To install Articulate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Articulate
CPAN shell
perl -MCPAN -e shell install Articulate
For more information on module installation, please visit the detailed CPAN module installation guide.