Fix assignment from magic SV that becomes a glob
Chip Salzenberg [Mon, 24 Mar 1997 15:51:51 +0000 (03:51 +1200)]
sv.c

diff --git a/sv.c b/sv.c
index f8b1904..33b72ff 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1925,10 +1925,16 @@ register SV *sstr;
        /* FALL THROUGH */
 
     default:
+       if (SvGMAGICAL(sstr)) {
+           mg_get(sstr);
+           if (SvTYPE(sstr) != stype) {
+               stype = SvTYPE(sstr);
+               if (stype == SVt_PVGV && dtype <= SVt_PVGV)
+                   goto glob_assign;
+           }
+       }
        if (dtype < stype)
            sv_upgrade(dstr, stype);
-       if (SvGMAGICAL(sstr))
-           mg_get(sstr);
     }
 
     sflags = SvFLAGS(sstr);