Minor issue with ping

"Thomas M. Payerle" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
Hi,

My colleagues and I encountered a problem in some code which seems
to be due to some impolite behavior on the part of the ping routine
in DBD::Oracle.

Basically, we had an eval block with a locally declared (my) CGI::Session
object using Oracle DB for storing session info.  When we raise an exception,
the CGI::Session is destroyed, which somewhere results in DBD::Oracle ping
being called.  ping() does not localize $@ for its eval block, thereby
clobbering the exception text in $@.

I believe adding a "local $@" in the ping routine resolves this issue
without any ill effect on the routine, as shown in attached patch.
Not really a bug, but I believe this is better behavior.

Tom Payerle
OIT-TSS-DCS				[email protected]
University of Maryland			(301) 405-6135
College Park, MD 20742-4111

PS: I just wanted to offer my gratitude to the DBD::Oracle developers for
their fine work on this module.
DBD-Oracle-ping-patch.patch (text/plain, 275 B)
Index: Oracle.pm
===================================================================
--- Oracle.pm	(revision 14165)
+++ Oracle.pm	(working copy)
@@ -295,6 +295,7 @@
 
     sub ping { 
 	my($dbh) = @_;
+	local $@;
 	my $ok = 0;
 	eval {
 	    local $SIG{__DIE__};
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.