You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Andrei A. Voropaev" <an...@securities.com> on 2001/11/20 10:35:33 UTC
Slightly OT: DBD::Oracle::ping
Hi!
In the code for DBD::Oracle::db::ping method there are lines
local $SIG{__DIE__};
local $SIG{__WARN__};
As I understand these lines don't do anything though I guess they are supposed
to suppress warning messages and possibly 'die' messages. Currently everytime
when ping fails and we have PrintError => 1 then the message goes into Apache error
log. What is worse if $dbh was disconnected then ping dies and kills the whole
process. As temporary fix we can user $dbh->{RaiseError} = 0, but then we'd
have to rewrite the code that was placed into eval blocks.
Is this a feature or something that should be fixed? Was it supposed to be
local $SIG{__WARN__} = sub {};
Andrei
Re: Slightly OT: DBD::Oracle::ping
Posted by Stas Bekman <st...@stason.org>.
Andrei A. Voropaev wrote:
> Hi!
>
> In the code for DBD::Oracle::db::ping method there are lines
>
> local $SIG{__DIE__};
> local $SIG{__WARN__};
>
> As I understand these lines don't do anything though I guess they are supposed
> to suppress warning messages and possibly 'die' messages. Currently everytime
> when ping fails and we have PrintError => 1 then the message goes into Apache error
> log. What is worse if $dbh was disconnected then ping dies and kills the whole
> process. As temporary fix we can user $dbh->{RaiseError} = 0, but then we'd
> have to rewrite the code that was placed into eval blocks.
>
> Is this a feature or something that should be fixed? Was it supposed to be
>
> local $SIG{__WARN__} = sub {};
That simply means that any die/warn handlers that the running code may
have set, are unset in the given scope. Therefore if there code wants to
print a warning or the code die()'s, the *default* handler will be used.
I think this is mostly used for protection from user-defined sighadler
which may have an ill-effect during eval {} blocks. See
http://perl.apache.org/guide/perl.html#Exception_Handling_for_mod_perl
I'm not familiar with DBD::Oracle, but you may need to run the faulty
code in the eval {} block to prevent die-ing.
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/