dougm 01/08/01 09:52:41
Modified: src/modules/perl modperl_io.c
Log:
better tracing of tie/untie STDIN/STDOUT
Revision Changes Path
1.3 +13 -7 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- modperl_io.c 2001/07/13 17:12:12 1.2
+++ modperl_io.c 2001/08/01 16:52:40 1.3
@@ -11,14 +11,26 @@
MP_INLINE void modperl_io_handle_untie(pTHX_ GV *handle)
{
sv_unmagic((SV*)handle, 'q');
+
+ MP_TRACE_g(MP_FUNC, "untie *%s(0x%lx), REFCNT=%d\n",
+ GvNAME(handle), (unsigned long)handle,
+ SvREFCNT((SV*)handle));
}
MP_INLINE void modperl_io_handle_tie(pTHX_ GV *handle,
char *classname, void *ptr)
{
SV *obj = modperl_ptr2obj(aTHX_ classname, ptr);
- modperl_io_handle_untie(aTHX_ handle);
+
+ if (mg_find((SV*)handle, 'q')) {
+ modperl_io_handle_untie(aTHX_ handle);
+ }
+
sv_magic((SV*)handle, obj, 'q', Nullch, 0);
+
+ MP_TRACE_g(MP_FUNC, "tie *%s(0x%lx) => %s, REFCNT=%d\n",
+ GvNAME(handle), (unsigned long)handle, classname,
+ SvREFCNT((SV*)handle));
}
MP_INLINE int modperl_io_handle_tied(pTHX_ GV *handle, char *classname)
@@ -52,9 +64,6 @@
IoFLUSH_off(PL_defoutgv); /* $|=0 */
- MP_TRACE_g(MP_FUNC, "tie *STDOUT(0x%lx) => Apache::RequestRec\n",
- (unsigned long)handle);
-
TIEHANDLE(handle, r);
return handle;
@@ -73,9 +82,6 @@
if (TIED(handle)) {
return handle;
}
-
- MP_TRACE_g(MP_FUNC, "tie *STDIN(0x%lx) => Apache::RequestRec\n",
- (unsigned long)handle);
TIEHANDLE(handle, r);