Message-Id: <
200107120625.f6C6PkJ13065@biz.bitpusher.com>
p4raw-id: //depot/perl@11306
sub EXTEND { }
sub UNSHIFT { scalar shift->SPLICE(0,0,@_) }
sub SHIFT { shift->SPLICE(0,1) }
-#sub SHIFT { (shift->SPLICE(0,1))[0] }
sub CLEAR { shift->STORESIZE(0) }
sub PUSH
for (my $i=0; $i < @_; $i++) {
$obj->STORE($off+$i,$_[$i]);
}
- return @result;
+ return wantarray ? @result : pop @result;
}
sub EXISTS {
#!./perl
-print "1..10\n";
+print "1..12\n";
@a = (1..10);
print "not " unless j(splice(@a)) eq j(1,2,7,3) && j(@a) eq '';
print "ok 10\n";
+# Tests 11 and 12:
+# [ID 20010711.005] in Tie::Array, SPLICE ignores context, breaking SHIFT
+
+my $foo;
+
+@a = ('red', 'green', 'blue');
+$foo = splice @a, 1, 2;
+print "not " unless $foo eq 'blue';
+print "ok 11\n";
+
+@a = ('red', 'green', 'blue');
+$foo = shift @a;
+print "not " unless $foo eq 'red';
+print "ok 12\n";