develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000330.005] defined ${$n} broken in 5.6 when $n is a number

Thread Previous
From:
Graham Barr
Date:
March 30, 2000 03:04
Subject:
Re: [ID 20000330.005] defined ${$n} broken in 5.6 when $n is a number
Message ID:
20000330120329.N18975@pobox.com
OK, I traced it to Change 2879 which modified pp_rv2sv not to
create GV. The problem is that for magical vars gv_fetchpv
depends on having the GV already there.

Graham.


Change 2879 by gsar@sparc26 on 1999/02/12 05:39:29

	fix ops that are not filehandle constructors to not create GV if it
	doesn't already exist (avoids leaks); extend semantics of defined()
	so that defined(*{$foo}) works (experimental)



==== //depot/perl/pp.c#99 (text) ====

@@ -240,9 +240,18 @@
 		RETSETUNDEF;
 	    }
 	    sym = SvPV(sv, n_a);
-	    if (PL_op->op_private & HINT_STRICT_REFS)
-		DIE(PL_no_symref, sym, "a symbol");
-	    sv = (SV*)gv_fetchpv(sym, TRUE, SVt_PVGV);
+	    if ((PL_op->op_flags & OPf_SPECIAL) &&
+		!(PL_op->op_flags & OPf_MOD))
+	    {
+		sv = (SV*)gv_fetchpv(sym, FALSE, SVt_PVGV);
+		if (!sv)
+		    RETSETUNDEF;
+	    }
+	    else {
+		if (PL_op->op_private & HINT_STRICT_REFS)
+		    DIE(PL_no_symref, sym, "a symbol");
+		sv = (SV*)gv_fetchpv(sym, TRUE, SVt_PVGV);
+	    }
 	}
     }
     if (PL_op->op_private & OPpLVAL_INTRO)

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About