diff options
-rw-r--r-- | pp.c | 8 | ||||
-rw-r--r-- | t/op/gv.t | 17 |
2 files changed, 20 insertions, 5 deletions
@@ -218,15 +218,15 @@ PP(pp_rv2gv) if (sv) SvFAKE_off(sv); } } - if (PL_op->op_private & OPpLVAL_INTRO) - save_gp(MUTABLE_GV(sv), !(PL_op->op_flags & OPf_SPECIAL)); if (sv && SvFAKE(sv)) { SV *newsv = sv_newmortal(); sv_setsv_flags(newsv, sv, 0); SvFAKE_off(newsv); - SETs(newsv); + sv = newsv; } - else SETs(sv); + if (PL_op->op_private & OPpLVAL_INTRO) + save_gp(MUTABLE_GV(sv), !(PL_op->op_flags & OPf_SPECIAL)); + SETs(sv); RETURN; } @@ -12,7 +12,7 @@ BEGIN { use warnings; -plan( tests => 230 ); +plan( tests => 231 ); # type coersion on assignment $foo = 'foo'; @@ -857,6 +857,21 @@ ok eval { *$glob = *foo; }, "Assigning a glob to a glob-with-sub that has lost its stash warks"; +{ + package Tie::Alias; + sub TIESCALAR{ bless \\pop } + sub FETCH { $${$_[0]} } + sub STORE { $${$_[0]} = $_[1] } + package main; + tie my $alias, 'Tie::Alias', my $var; + no warnings 'once'; + $var = *galobbe; + { + local *$alias = []; + $var = 3; + is $alias, 3, "[perl #77926] Glob reification during localisation"; + } +} __END__ Perl |