in reply to how do i get the database error from this code

Have you looked at DBI and what it says about errors?

  • Comment on Re: how do i get the database error from this code

Replies are listed 'Best First'.
Re^2: how do i get the database error from this code
by Anonymous Monk on Jan 04, 2011 at 17:12 UTC
    Yes i've read all of the DBI page but i'm a perl beginner and don't really know how to use the eval structure. I've read about setting RaiseError = 1/0. I want to use the automatic error handling from setting raise error = 1. However i don't know how to 'catch' the die in an eval loop so I can customise the error message for the end user . Will the error message raised by the dbi simply be in the $@ variable so I can work with that?

      Will the error message raised by the dbi simply be in the $@ variable so I can work with that?

      Yes. $dbh->err and the like should also be populated.