Subject: | splice allowed? |
Date: | Fri, 13 Jul 2012 21:10:15 +0100 |
To: | bug-Tie-Array-Sorted [...] rt.cpan.org |
From: | Mark Emmerson <nodmonkey [...] gmail.com> |
Hello Tony,
Is splicing a Tie::Array::Sorted array permitted?
When I run the following script:
#!/usr/bin/perl
use strict;
use warnings;
use Tie::Array::Sorted;
my @untied = ();
my @tied = ();
tie @tied, "Tie::Array::Sorted", sub { $_[0] <=> $_[1] };
foreach (0..5) {
push @untied, $_;
push @tied, $_;
}
splice @untied, 3, 1;
splice @tied, 3, 1;
print "untied: ", join(",", @untied), "\n";
print "tied: ", join(",", @tied), "\n";
I get this output, indicating that the wrong element has been removed from the @tied array:
untied: 0,1,2,4,5
tied: 0,1,2,3,4
I am using Perl 5.14.
Perhaps I am doing something incorrectly.
If this is a bug, or an unsupported operation, it would be good to note it on the CPAN page.
Thanks for writing/maintaining an otherwise very helpful module!
Mark