Data::MultiValued::Tags - Handle values with tags
version 0.0.1_4
use Data::MultiValued::Tags; my $obj = Data::MultiValued::Tags->new(); $obj->set({ tag => 'tag1', value => 'a string', }); say $obj->get({tag=>'tag1'}); # prints 'a string' say $obj->get({tag=>'tag2'}); # dies
set
$obj->set({ tag => $the_tag, value => $the_value });
Stores the given value for the given tag. Replaces existing values. Does not throw exceptions.
Not passing in a tag is equivalent to passing in tag => undef.
tag
tag => undef
No cloning is done: if you pass in a reference, the reference is just stored.
get
my $value = $obj->get({ tag => $the_tag });
Retrieves the value for the given tag. Throws a Data::MultiValued::Exceptions::TagNotFound exception if the tag does not exists in this object.
No cloning is done: if a reference was stored, you get it back untouched.
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 clears everything. Yes, this means that there is no way to just clear the value for the undef tag.
undef
These are used through Data::MultiValued::UglySerializationHelperRole.
_rebless_storage
Blesses the storage into Data::MultiValued::TagContainer.
_as_hash
Returns the internal representation with no blessed hashes, with as few copies as possible.
Data::MultiValued::TagContainer, Data::MultiValued::Exceptions
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.