MVC::Neaf::Util::Container - path & method based container for Not Even A Framework
This is utility class. Nothing to see here unless one intends to work on MVC::Neaf itself.
This class can hold multiple entities addressed by paths and methods and extract them in the needed order.
my $c = MVC::Neaf::Util::Container->new;
$c->store( "foo", path => '/foo', method => 'GET' );
$c->store( "bar", path => '/foo/bar', exclude => '/foo/bar/baz' );
$c->fetch( path => "/foo", method => 'GET' ); # foo
$c->fetch( path => "/foo/bar", method => 'GET' ); # foo bar
$c->fetch( path => "/foo/bar", method => 'POST' );
# qw(bar) - 'foo' limited to GET only
$c->fetch( path => "/foo/bar/baz", method => 'GET' );
# qw(foo) - 'bar' excluded
Only store one item per (path,method) pair, and fail loudly in case of conflicts.
store( $data, %spec )
Store $data in container. Spec may include:
store_check_conflict( path => ..., method => ... )
Check that no previous declarations conflict with the new one.
This is only if exclusive was specified.
Returns methods currently in the storage.
Returns paths for given method, or all if no method given.
fetch( %spec )
Return all matching previously stored objects, from shorter to longer paths, in order of addition.
Spec may include:
Same as fetch(), but only return the last (last added & longest path) element.
Same as fetch(), but return additional info instead of just stored item:
data => $your_item_here,
path => $all_the_paths,
method => $list_of_methods,
This module is part of MVC::Neaf suite.
Copyright 2016-2019 Konstantin S. Uvarin firstname.lastname@example.org.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install MVC::Neaf, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.