In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/8752206e276cffe588c0932b5a9f2331640e8447?hp=19b96a2b521beb3b36fd375c46258d57d7d8a31e>

- Log -----------------------------------------------------------------
commit 8752206e276cffe588c0932b5a9f2331640e8447
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sun Oct 24 18:14:47 2010 -0700

    [perl #77496] tied gets scalars and globs confused
    
    Make pp_tied use the SvFAKE flag to distinguish between tied scalars
    and tied handles. This is now possible as of change 2acc3314.
    
    This fixes the problem of tied($scalar) ignoring the tie if the last
    thing returned or assigned happened to be a glob.
-----------------------------------------------------------------------

Summary of changes:
 pp_sys.c   |    2 +-
 t/op/tie.t |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/pp_sys.c b/pp_sys.c
index 78b635f..f47395b 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -941,7 +941,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 6e52a6e..a9fb89e 100644
--- a/t/op/tie.t
+++ b/t/op/tie.t
@@ -939,3 +939,17 @@ sub IO::File::TIEARRAY {
 fileno FOO; tie @a, "FOO"
 EXPECT
 Can't locate object method "TIEARRAY" via package "FOO" at - line 5.
+########
+
+# 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

--
Perl5 Master Repository

Reply via email to