abubacker has asked for the wisdom of the Perl Monks concerning the following question:

I am using a DBIx::RetryOverdisconnect module for my database operation
This module make my process exits when the wrong query has been given in "prepare() and execute()" ( lets say wrong table name ) where DBI tells the error and continue the process
When I go through the module I found that they are using Exception::Class module to generate an error using rethrow() ,it prints the error and exits the process itself
I am ready to change the RetryOverdisconnect.pm
All I want to know is how to generate an error message with out my process dies using the Exception::Class module

  • Comment on How to prevent Exception::Class to exit the process

Replies are listed 'Best First'.
Re: How to prevent Exception::Class to exit the process
by moritz (Cardinal) on May 10, 2011 at 07:34 UTC
Re: How to prevent Exception::Class to exit the process
by anonymized user 468275 (Curate) on May 10, 2011 at 09:29 UTC
    I would first create a package that inherits DBIx:RetryOverdisconnect and then override any mortal methods with a routine that applies Moritz's eval solution e.g.
    package DBIx::RetryOverDisconnects::Immortal; use DBIx::RetryOverDisconnects; sub DBIx::RetryOverDisconnects::Immortal::txn_do { my ($self, $coderef) = @_; my $success = 0; eval( $success = $self ->DBIx::RetryOverDisconnects::txn_do($coder +ef) ); $success; }
    The use of this kind of module should obviate the need to recode the CPAN module.

    One world, one people