develooper Front page | perl.perl5.changes | Postings from April 2008

Change 33770: [PATCH] Double magic/warnings with tie $x, $m

From:
Rafael Garcia-Suarez
Date:
April 30, 2008 05:00
Subject:
Change 33770: [PATCH] Double magic/warnings with tie $x, $m
Change 33770 by rgs@scipion on 2008/04/30 11:51:12

	Subject: [PATCH] Double magic/warnings with tie $x, $m
	From: "Vincent Pit" <perl@profvince.com>
	Date: Wed, 30 Apr 2008 13:14:00 +0200 (CEST)
	Message-ID: <62186.92.128.43.82.1209554040.squirrel@92.128.43.82>

Affected files ...

... //depot/perl/pp_sys.c#560 edit
... //depot/perl/t/lib/warnings/9uninit#28 edit

Differences ...

==== //depot/perl/pp_sys.c#560 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#559~33766~	2008-04-30 01:17:51.000000000 -0700
+++ perl/pp_sys.c	2008-04-30 04:51:12.000000000 -0700
@@ -825,7 +825,7 @@
 	    break;
     }
     items = SP - MARK++;
-    if (sv_isobject(*MARK)) {
+    if (sv_isobject(*MARK)) { /* Calls GET magic. */
 	ENTER;
 	PUSHSTACKi(PERLSI_MAGIC);
 	PUSHMARK(SP);
@@ -839,10 +839,12 @@
 	/* Not clear why we don't call call_method here too.
 	 * perhaps to get different error message ?
 	 */
-	stash = gv_stashsv(*MARK, 0);
+	STRLEN len;
+	const char *name = SvPV_nomg_const(*MARK, len);
+	stash = gv_stashpvn(name, len, 0);
 	if (!stash || !(gv = gv_fetchmethod(stash, methname))) {
 	    DIE(aTHX_ "Can't locate object method \"%s\" via package \"%"SVf"\"",
-		 methname, SVfARG(*MARK));
+		 methname, SVfARG(SvOK(*MARK) ? *MARK : &PL_sv_no));
 	}
 	ENTER;
 	PUSHSTACKi(PERLSI_MAGIC);

==== //depot/perl/t/lib/warnings/9uninit#28 (text) ====
Index: perl/t/lib/warnings/9uninit
--- perl/t/lib/warnings/9uninit#27~33766~	2008-04-30 01:17:51.000000000 -0700
+++ perl/t/lib/warnings/9uninit	2008-04-30 04:51:12.000000000 -0700
@@ -1138,7 +1138,6 @@
 eval { my $x; sysread $m1, $x, $g1, $g2 };
 EXPECT
 Use of uninitialized value $m1 in tie at - line 5.
-Use of uninitialized value $m1 in tie at - line 5.
 Use of uninitialized value $m1 in ref-to-glob cast at - line 7.
 Use of uninitialized value $g1 in read at - line 7.
 Use of uninitialized value $m1 in ref-to-glob cast at - line 8.
End of Patch.



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About