From 5cd777d053e604f209c064419ba3e39346315949 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Thu, 10 Nov 2011 18:01:33 +0000 Subject: fix inserting range w/o overlap --- lib/Data/MultiValued/RangeContainer.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Data/MultiValued/RangeContainer.pm b/lib/Data/MultiValued/RangeContainer.pm index 474626f..e9b1b62 100644 --- a/lib/Data/MultiValued/RangeContainer.pm +++ b/lib/Data/MultiValued/RangeContainer.pm @@ -154,13 +154,14 @@ sub _splice_slot { # by costruction, the first and the last may have to be split, all # others must be removed - my $first_to_replace = $overlap->[0], - my $last_to_replace = $overlap->[-1], + my $first_to_replace; my $how_many = @$overlap; my @replacement = $new ? ($new) : (); if ($how_many > 0) { # we have to splice + $first_to_replace = $overlap->[0]; + my $last_to_replace = $overlap->[-1]; my $first = $self->_storage->[$first_to_replace]; my $last = $self->_storage->[$last_to_replace]; @@ -181,6 +182,9 @@ sub _splice_slot { } } } + else { + $first_to_replace = $before->[-1]+1; + } splice @{$self->_storage}, $first_to_replace,$how_many, -- cgit v1.2.3