Make push, etc., work on tied scalars
authorFather Chrysostomos <sprout@cpan.org>
Tue, 19 Apr 2011 05:25:30 +0000 (22:25 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 19 Apr 2011 05:43:13 +0000 (22:43 -0700)
I broke this with commit d4fc441

pp.c
t/op/tie_fetch_count.t

diff --git a/pp.c b/pp.c
index 4c88270..d91faa4 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -5400,6 +5400,7 @@ static AV *
 S_deref_plain_array(pTHX_ AV *ary)
 {
     if (SvTYPE(ary) == SVt_PVAV) return ary;
+    SvGETMAGIC((SV *)ary);
     if (!SvROK(ary) || SvTYPE(SvRV(ary)) != SVt_PVAV)
        Perl_die(aTHX_ "Not an ARRAY reference");
     else if (SvOBJECT(SvRV(ary)))
index b0c1dd4..69d4619 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
-    plan (tests => 208);
+    plan (tests => 209);
 }
 
 use strict;
@@ -162,6 +162,7 @@ tie my $var1 => 'main', \1;
 $dummy  = $$var1        ; check_count '${}';
 tie my $var2 => 'main', [];
 $dummy  = @$var2        ; check_count '@{}';
+$dummy  = shift $var2   ; check_count 'shift arrayref';
 tie my $var3 => 'main', {};
 $dummy  = %$var3        ; check_count '%{}';
 {