summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGianni Ceccarelli <dakkar@thenautilus.net>2011-11-10 18:01:33 +0000
committerGianni Ceccarelli <dakkar@thenautilus.net>2011-11-10 18:01:33 +0000
commit5cd777d053e604f209c064419ba3e39346315949 (patch)
tree8409f6a0cccc72bdae5b0dc9adea689104eab195 /lib
parentre-enable git plugins in dzil (diff)
downloaddata-multivalued-5cd777d053e604f209c064419ba3e39346315949.tar.gz
data-multivalued-5cd777d053e604f209c064419ba3e39346315949.tar.bz2
data-multivalued-5cd777d053e604f209c064419ba3e39346315949.zip
fix inserting range w/o overlap
Diffstat (limited to 'lib')
-rw-r--r--lib/Data/MultiValued/RangeContainer.pm8
1 files changed, 6 insertions, 2 deletions
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,