Data::MultiValued::TagContainer - container for tagged values
version 0.0.1_4
Please don't use this module directly, use Data::MultiValued::Tags.
This module implements the storage for tagged data. It's almost exactly a hash, the main difference being that undef is a valid key and it's distinct from the empty string.
undef
Another difference is that you get an exception if you try to access a tag that's not there.
Data is kept in "storage cells", as created by "_create_new_inferior" (by default, a hashref).
get
my $value = $obj->get({ tag => $the_tag });
Retrieves the "storage cell" for the given tag. Throws a Data::MultiValued::Exceptions::TagNotFound exception if the tag does not exists in this object.
Not passing in a tag is equivalent to passing in tag => undef.
tag
tag => undef
get_or_create
$obj->get_or_create({ tag => $the_tag });
Retrieves the "storage cell" for the given tag. If the tag does not exist, creates a new cell (see "_create_new_inferior"), sets it for the tag, and returns it.
clear
$obj->clear({ tag => $the_tag });
Deletes the given tag and all data associated with it. Does not throw exceptions: if the tag does not exist, nothing happens.
Not passing in a tag, or passing tag => undef, clears everything. If you want to only clear the undef tag, you may call _clear_default_tag (which is considered a "protected" method).
_clear_default_tag
all_tags
my @tags = $obj->all_tags;
Returns all the tags defined in this object. Does not return the undef tag.
_create_new_inferior
Returns a new "storage cell", by default an empty hashref. See Data::MultiValued::TagContainerForRanges for an example of use.
Gianni Ceccarelli <dakkar@thenautilus.net>
This software is copyright (c) 2011 by Net-a-Porter.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::MultiValued, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::MultiValued
CPAN shell
perl -MCPAN -e shell install Data::MultiValued
For more information on module installation, please visit the detailed CPAN module installation guide.