From: Chandrasekaran Suresh [mailto:[EMAIL PROTECTED]
> 
>  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.. 

You can always use the "return" command to exit from a subroutine (in a
module or not).  Then you can check the return code of the routine, if you
provided one, to determine if it exited normally or not.

For example:

    sub db_routine {
        $err = do_db_operation;
        if ($err) {
            return $err;
        }
        else {
            do_anything_else;
            return $results;
        }

    $res = db_routine;
    if ($res =~ /error/i) {
        print "Got an error\n";
    }

Of course, you can make this as complex as needed.  My database routines are
a bit more complex to allow for better error reporting and more information
returned from the routine.

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

Reply via email to