-- arun arora <[EMAIL PROTECTED]>

> Hi All,
>
>        I have seen some standard SybPerl programs that are using the
>
>         ct_callback(CS_CLIENTMSG_CB,"msg_cb");
>         ct_callback(CS_SERVERMSG_CB,"srv_cb");
>
> for the error handling. This is i suppose the comcept of completion
> callback
>
>     I am supposed to change these Programs to work with Oracle 9i on
> Solaris. I want to use DBI Perl. I am not able to decide that what would
> be the best way to handle errors when coding with DBI Perl . As per My
> current knowledge of DBI there is no concept of completion callbacks in
> DBI.
>
>     If someone has handled this sort of problem please help me out here.

Errors are most easly handled with block eval's:

    eval
    {
        ... # code here dies if there is an error
    };

    if( $@ )
    {
        ... # code here can check $@ for the message
    }

Whatever message the die passed out of the eval will be
in $@; which is guaranteed to be undef if nothing died.

This is the simplest way to deal with things since the
eval-ed code doesn't need to check for errors itself.

The DBI book and online doc's describe using this.

--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 800 762 1582

Reply via email to