Author: hmbrand
Date: Tue Sep 15 13:28:31 2009
New Revision: 13344

Modified:
   dbi/trunk/DBI.xs

Log:
Fix for DBI->trace (4, *FOO);

Still have to write tests and check against perl-5.8.x

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Tue Sep 15 13:28:31 2009
@@ -811,11 +811,15 @@
        SvREFCNT_inc(io);
        DBIS->logfp_ref = io;
     }
-    else if (0) {
-       /* PVGV -> dup and use that file handle
-        * SvOK -> use the stringification
-        * else    close the file handle and revert to the default of 
PerlIO_stderr()
-        */
+    else if (isGV_with_GP(file)) {
+       io = GvIO(file);
+       if (!io || !(fp = IoOFP(io))) {
+           warn("DBI trace filehandle from GLOB is not valid");
+           return 0;
+       }
+       close_trace_file(aTHX);
+       SvREFCNT_inc(io);
+       DBIS->logfp_ref = io;
     }
     else {
        filename = (SvOK(file)) ? SvPV_nolen(file) : Nullch;

Reply via email to