From 7e72c4cdba86f0f50aa1783b330a604034d221ae Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Tue, 15 Nov 2011 18:13:43 +0000 Subject: helper methods for users --- lib/Data/MultiValued/RangeContainer.pm | 15 +++++++++++++++ lib/Data/MultiValued/TagContainer.pm | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/Data/MultiValued/RangeContainer.pm b/lib/Data/MultiValued/RangeContainer.pm index 0bfe8cd..83dae11 100644 --- a/lib/Data/MultiValued/RangeContainer.pm +++ b/lib/Data/MultiValued/RangeContainer.pm @@ -268,4 +268,19 @@ sub _splice_slot { return $new; } +=head2 C + + my @ranges = $obj->all_ranges; + +Returns all the ranges defined in this object, as a list of 2-elements +arrayrefs. + +=cut + +sub all_ranges { + my ($self) = @_; + + return map { [ $_->{from}, $_->{to} ] } @{$self->_storage}; +} + 1; diff --git a/lib/Data/MultiValued/TagContainer.pm b/lib/Data/MultiValued/TagContainer.pm index b7a9b13..bdeca24 100644 --- a/lib/Data/MultiValued/TagContainer.pm +++ b/lib/Data/MultiValued/TagContainer.pm @@ -35,6 +35,7 @@ has _storage => ( _get_tag => 'get', _create_tag => 'set', _delete_tag => 'delete', + all_tags => 'keys', }, ); @@ -150,6 +151,13 @@ sub clear { return; } +=head2 C + + my @tags = $obj->all_tags; + +Returns all the tags defined in this object. Does not return the +C tag. + =head2 C<_create_new_inferior> Returns a new "storage cell", by default an empty hashref. See -- cgit v1.2.3