develooper Front page | perl.perl5.porters | Postings from September 2003

[PATCH] don't defer :unique to attributes.pm

Thread Next
From:
Rafael Garcia-Suarez
Date:
September 9, 2003 02:24
Subject:
[PATCH] don't defer :unique to attributes.pm
Message ID:
20030909111623.57bcb92b.rgarciasuarez@free.fr
The conservative patch below avoids loading attributes.pm when
the :unique attribute is seen in some souce code by a non-threaded
perl. I suggest that it should go in maint as well. There's no point
deferring the handling to a builtin attibute like :unique.

A less conservative patch would be to simply remove the #ifdef
here, because I don't see why GvUNIQUE shouldn't be set on a
non-ithreaded perl. But I'm no expert in multiplicity internals.

With this patch Liz's warnings.pl patch can be reapplied safely.

--- toke.c	(revision 2476)
+++ toke.c	(working copy)
@@ -3036,10 +3036,12 @@
 			CvMETHOD_on(PL_compcv);
 		    else if (!PL_in_my && len == 9 && strnEQ(s, "assertion", len))
 		        CvASSERTION_on(PL_compcv);
-#ifdef USE_ITHREADS
 		    else if (PL_in_my == KEY_our && len == 6 &&
 			     strnEQ(s, "unique", len))
+#ifdef USE_ITHREADS
 			GvUNIQUE_on(cGVOPx_gv(yylval.opval));
+#else
+			; /* skip that case to avoid loading attributes.pm */
 #endif
 		    /* After we've set the flags, it could be argued that
 		       we don't need to do the attributes.pm-based setting
End of Patch.

-- 
modelinesig vim:ft=diff

Thread Next


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