Perl supports exception handling with the C<eval> keyword.

   package everything_is_an_error;
   sub AUTOLOAD { die "$AUTOLOAD is an error! (called with args @_)\n" };

   package Chandrasekaran;
   eval {
      everything_is_an_error->wibble('frobnitz','lumpengroovy')
   }

   print "We got an error, yet we did not exit.  That error was <<<$@>>>\n";


so in your case you want to do something like

    eval {database_routine_call_that_sometimes_throws}
    $@ and do {
              graceful cleanup; 
              return $something_indicating_we_are_returning_on_error_not_success
    };



hope that helps


On 7/26/05, Chandrasekaran Suresh <[EMAIL PROTECTED]> wrote:
> Hello,
> 
>  I am calling a perl module from my one perl script.
> Inside the module I am working with some database. IF
> found error during the execution in the module in need
> to exit from the subroutine and continues the
> process..
> 
> How to handle this situation
> 
> Please advice  me
> 
> Regards,
> Suresh C
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> ActivePerl mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 


-- 
David L Nicol
I've got your Oz right here
http://cronos.advenge.com/pc/oz/TOC.html

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to