Tim Bunce wrote:
On Wed, Dec 13, 2006 at 11:31:00AM -0800, Dean Arnold wrote:
I realize the tracing is currently buried in XS code, but
it appears the HandleError invokation code could be copied
to provide the ability.

Only for errors, not for general tracing.

Sorry, I meant in a general sense, the plumbing could be copy/paste/edit'd.


Has this been discussed before, or have I overlooked something that already
exists ? It seems like a capability that would be useful.

It has been raised before. The only viable approach is to use a tied
filehandle - but I've never got round to doing the plumbing.

I'd imagine that some simple changes to set_trace_file() in DBI.xs would
suffice.


Are you saying that just changing set_trace_file() to accept a filehandle
would suffice ? Then the app can supply its own tie'd filehandle to
trace() ? The tied filehandle occured to me, but as the trace stuff is XS code,
I was concerned about (1) whether the PerlIO XS functions were smart about tie'd
handles, and (2) the caveat in perltie ie "This is partially implemented now.".

So, if I were to add just this bit of code to set_trace_file:

    if (SvROK(file)) {
    /* DAA must be a filehandle...we hope */
    /* but how do we tell, and how do we get the PerlIO object from an SV ? */
        fp = (PerlIO *)file;
    }
    else { /* the current filename stuff */ }

..would it magically work ? Any idea how I get the PerlIO* object from the
SV* input ? I don't see anything in perlapio, perlapi, or perlguts to guide me.

TIA, Dean

Reply via email to