Data::MultiValued::TagsAndRanges - Handle values with tags and validity ranges
version 0.0.1_4
use Data::MultiValued::TagsAndRanges; my $obj = Data::MultiValued::TagsAndRanges->new(); $obj->set({ tag => 'tag1', from => 10, to => 20, value => 'foo', }); say $obj->get({tag => 'tag1', at => 15}); # prints 'foo' say $obj->get({tag => 'tag1', at => 35}); # dies say $obj->get({tag => 'tag2', at => 15}); # dies
set
$obj->set({ tag => $the_tag, from => $min, to => $max, value => $the_value });
Stores the given value for the given tag and range. Does not throw exceptions.
See "set" in Data::MultiValued::Tags and "set" in Data::MultiValued::Ranges for more details.
get
my $value = $obj->get({ tag => $the_tag, at => $point });
Retrieves the value for the given tag and point. Throws a Data::MultiValued::Exceptions::RangeNotFound exception if no ranges exist in this object that include the point, and Data::MultiValued::Exceptions::TagNotFound exception if the tag does not exists in this object.
See "get" in Data::MultiValued::Tags and "get" in Data::MultiValued::Ranges for more details.
clear
$obj->clear({ tag => $the_tag, from => $min, to => $max });
If a range is specified, deletes all values for the given range and tag. If no range is specified, delete all values for the given tag.
Does not throw exceptions.
See "clear" in Data::MultiValued::Tags and "clear" in Data::MultiValued::Ranges for more details.
These are used through Data::MultiValued::UglySerializationHelperRole.
_rebless_storage
Blesses the storage into Data::MultiValued::TagContainerForRanges, then calls _rebless_storage on it.
_as_hash
Returns the internal representation with no blessed hashes, with as few copies as possible. Depends on "_as_hash" in Data::MultiValued::TagContainerForRanges.
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.