diff options
Diffstat (limited to 'lib/Data/MultiValued/TagsAndRanges.pm')
-rw-r--r-- | lib/Data/MultiValued/TagsAndRanges.pm | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/lib/Data/MultiValued/TagsAndRanges.pm b/lib/Data/MultiValued/TagsAndRanges.pm index 32e2acb..204f858 100644 --- a/lib/Data/MultiValued/TagsAndRanges.pm +++ b/lib/Data/MultiValued/TagsAndRanges.pm @@ -38,20 +38,6 @@ sub _build__storage { Data::MultiValued::TagContainerForRanges->new(); } -sub _rebless_storage { - my ($self) = @_; - - bless $self->{_storage},'Data::MultiValued::TagContainerForRanges'; - $self->_storage->_rebless_storage; -} - -sub _as_hash { - my ($self) = @_; - - my $ret = $self->_storage->_as_hash; - return {_storage=>$ret}; -} - =head2 C<set> $obj->set({ tag => $the_tag, from => $min, to => $max, value => $the_value }); @@ -74,7 +60,7 @@ sub set { ); $self->_storage->get_or_create(\%args) - ->set_or_create(\%args) + ->get_or_create(\%args) ->{value} = $args{value}; } @@ -136,4 +122,38 @@ sub clear { } } +=head1 Serialisation helpers + +These are used through +L<Data::MultiValued::UglySerializationHelperRole>. + +=head2 C<_rebless_storage> + +Blesses the storage into L<Data::MultiValued::TagContainerForRanges>, +then calls C<_rebless_storage> on it. + +=cut + +sub _rebless_storage { + my ($self) = @_; + + bless $self->{_storage},'Data::MultiValued::TagContainerForRanges'; + $self->_storage->_rebless_storage; +} + +=head2 C<_as_hash> + +Returns the internal representation with no blessed hashes, with as +few copies as possible. Depends on +L<Data::MultiValued::TagContainerForRanges/_as_hash>. + +=cut + +sub _as_hash { + my ($self) = @_; + + my $ret = $self->_storage->_as_hash; + return {_storage=>$ret}; +} + 1; |