dougm 01/09/12 21:10:55
Modified: src/modules/perl modperl_io.c
Removed: lib/ModPerl XSLoader.pm
Log:
fix tied filehandle breakage caused by bleedperl change #11639
Revision Changes Path
1.4 +9 -1 modperl-2.0/src/modules/perl/modperl_io.c
Index: modperl_io.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- modperl_io.c 2001/08/01 16:52:40 1.3
+++ modperl_io.c 2001/09/13 04:10:55 1.4
@@ -8,9 +8,15 @@
#define TIED(handle) \
modperl_io_handle_tied(aTHX_ handle, "Apache::RequestRec")
+/*
+ * XXX: bleedperl change #11639 switch tied handle magic
+ * from living in the gv to the GvIOp(gv), so we have to deal
+ * with both to support 5.6.x
+ */
MP_INLINE void modperl_io_handle_untie(pTHX_ GV *handle)
{
sv_unmagic((SV*)handle, 'q');
+ sv_unmagic((SV*)GvIOp(handle), 'q');
MP_TRACE_g(MP_FUNC, "untie *%s(0x%lx), REFCNT=%d\n",
GvNAME(handle), (unsigned long)handle,
@@ -27,6 +33,7 @@
}
sv_magic((SV*)handle, obj, 'q', Nullch, 0);
+ sv_magic((SV*)GvIOp(handle), obj, 'q', Nullch, 0);
MP_TRACE_g(MP_FUNC, "tie *%s(0x%lx) => %s, REFCNT=%d\n",
GvNAME(handle), (unsigned long)handle, classname,
@@ -36,8 +43,9 @@
MP_INLINE int modperl_io_handle_tied(pTHX_ GV *handle, char *classname)
{
MAGIC *mg;
+ SV *sv = SvMAGICAL(GvIOp(handle)) ? (SV*)GvIOp(handle) : (SV*)handle;
- if (SvMAGICAL(handle) && (mg = mg_find((SV*)handle, 'q'))) {
+ if (SvMAGICAL(sv) && (mg = mg_find(sv, 'q'))) {
char *package = HvNAME(SvSTASH((SV*)SvRV(mg->mg_obj)));
if (!strEQ(package, classname)) {