in reply to Re: dbi error handling
in thread dbi error handling

I've started the habit of using:
HandleError => sub { Carp::confess($_[0]) },
in my connect() code. I started doing this because some versions of DBD::Sybase don't report the line number of the error with just RaiseError set (because the error messages had a newline on the end of them). Also, it's just nice to have a stack trace when a DBI call fails from deep within your function calls.

Replies are listed 'Best First'.
Re^3: dbi error handling
by Anonymous Monk on Dec 22, 2010 at 03:31 UTC
    Could you explain that a little bit more (I'm a perl beginner) please? Where does that code go? thanks
Re^3: dbi error handling
by Anonymous Monk on Dec 22, 2010 at 04:01 UTC
    I've seen this in the dbi docs
    http://search.cpan.org/~timb/DBI-1.615/DBI.pm#HandleError
    What data is in $_[0]
      Huh, I didn't see that in the docs before (or forgot about it). $_[0] is the first argument to the function, i.e. the first element of the @_ array.