I'm trying to write a WARN handler for an Informix application. I want to be able to get to stuff in the SQLCA, which, if I read things correctly, means I need the statement handle for the offending action.
I have not figured out how to get that without resorting to a global-
like variable.
Is there some secret handshake that will let me obtain the last statement handle that was invoked?
I've looked at the Cheetah book, scanned the last couple months of the archives here, checked dbi.perl.org (or was it .com?), and given the source a (very) cursory overlook, all to no avail.
I'd be grateful for clues and pointers to clues.
There are 5 tests in the t directory for DBD::Informix which mess with WARN handlers, but none do exactly what you want. However, if you can set your warning handler locally, can't you use Perl's anonymous subs to deal with it?
$SIG{__WARN__} = sub { do_the_real_job($sth, $_[0]); };
$sth->...
$SIG{__WARN__} = 'DEFAULT';When the handler sub is executed, doesn't this use the $sth in scope when the sub is defined? That's an unverified hypothesis...
--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED]) #include <disclaimer.h>
Guardian of DBD::Informix 1.04.PC1 -- http://dbi.perl.org/
