The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::MultiValued::TagsAndRanges - Handle values with tags and validity ranges

VERSION

version 0.0.1_4

SYNOPSIS

  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

METHODS

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.

Serialisation helpers

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.

AUTHOR

Gianni Ceccarelli <dakkar@thenautilus.net>

COPYRIGHT AND LICENSE

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.