diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-05-13 08:29:42 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-06-11 11:16:45 -0700 |
commit | 4be76e1f2b4f53b080616615372a4ebaff876c87 (patch) | |
tree | b6610791f40258e254d8f30d4364ef09533d90dd | |
parent | 68ef19bb9eb24fa24f8c7ecfd08a99a0f2831d28 (diff) | |
download | perl-4be76e1f2b4f53b080616615372a4ebaff876c87.tar.gz |
Revert "Revert "[perl #77496] tied gets scalars and globs confused""
This reverts commit b029825916bf29623e00b45fa4226fab0d52d217.
-rw-r--r-- | pp_sys.c | 2 | ||||
-rw-r--r-- | t/op/tie.t | 14 |
2 files changed, 15 insertions, 1 deletions
@@ -951,7 +951,7 @@ PP(pp_tied) const char how = (SvTYPE(sv) == SVt_PVHV || SvTYPE(sv) == SVt_PVAV) ? PERL_MAGIC_tied : PERL_MAGIC_tiedscalar; - if (isGV_with_GP(sv) && !(sv = MUTABLE_SV(GvIOp(sv)))) + if (isGV_with_GP(sv) && !SvFAKE(sv) && !(sv = MUTABLE_SV(GvIOp(sv)))) RETPUSHUNDEF; if ((mg = SvTIED_mg(sv, how))) { diff --git a/t/op/tie.t b/t/op/tie.t index 8e17d16d06..44d9269a74 100644 --- a/t/op/tie.t +++ b/t/op/tie.t @@ -1007,3 +1007,17 @@ tie $x, ""; print "ok\n"; EXPECT ok +######## + +# tied() should still work on tied scalars after glob assignment +sub TIESCALAR {bless[]} +sub FETCH {*foo} +sub f::TIEHANDLE{bless[],f} +tie *foo, "f"; +tie $rin, ""; +[$rin]; # call FETCH +print ref tied $rin, "\n"; +print ref tied *$rin, "\n"; +EXPECT +main +f |