patch for GvNAME changes in 5.9.4
Nicholas Clark <[email protected]> Mon, 6 Mar 2006 15:21:14 +0000
| Newsgroups | gmane.comp.lang.perl.modules.class-methodmaker |
|---|---|
| Message-ID | <[email protected]> |
I've been changing the layout of GVs in development perl to save memory. (I
think I've roughly halved the memory usage). One side effect is that GV names
are now stored in shared hash key scalars, with GvNAME and GvNAMELEN no longer
assignable. Searching CPAN suggests that Class::MethodMaker is actually the
only module that assigns to GvNAME, so I'm comfortable that these changes are
not going to cause widespread pain.
The appended patch to MethodMaker.xs makes it compile on both development
perl with the changes, and existing stable perls without. I hope that you're
able to apply this or something functionally equivalent to Class::MethodMaker.
Nicholas Clark
--- MethodMaker.xs.orig Sat Nov 26 09:43:34 2005
+++ MethodMaker.xs Mon Mar 6 15:13:27 2006
@@ -2,6 +2,11 @@
#include "perl.h"
#include "XSUB.h"
+#ifndef gv_name_set
+#define gv_name_set(gv, subname, len, flags) \
+ GvNAME(gv) = savepv(subname); GvNAMELEN(gv) = strlen(subname)
+#endif
+
MODULE = Class::MethodMaker PACKAGE = Class::MethodMaker
void
@@ -9,5 +14,4 @@ set_sub_name(SV *sub, char *pname, char
CODE:
CvGV((GV*)SvRV(sub)) = gv_fetchpv(stashname, TRUE, SVt_PV);
GvSTASH(CvGV((GV*)SvRV(sub))) = gv_stashpv(pname, 1);
- GvNAME(CvGV((GV*)SvRV(sub))) = savepv(subname);
- GvNAMELEN(CvGV((GV*)SvRV(sub))) = strlen(subname);
+ gv_name_set(CvGV((GV*)SvRV(sub)), subname, strlen(subname), 0);
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642