Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

How can i find out the information that is returned by the perl dbi when it encounters an error and dies when RaiseError=1. I can't find any documentation for what the error message contains. Is there anyway I can control the information in the error mesage. I believe perl dbi has these useful methods for error checking

DBI defines several error diagnostic methods $rv = $h->err(); = error number $str = $h->errstr(); = error string $str = $h->state(); = database state
It would be good if RaiseError=1 returned information from all 3 of these methods but i don't know how to find out what it returns.

thanks a lot

Replies are listed 'Best First'.
Re: dbi raiseError = 1
by locked_user sundialsvc4 (Abbot) on Dec 21, 2010 at 16:20 UTC

    Perhaps you want $DBI::errstr.   Carefully read the entire documentation for DBI.

    (And, please note, I am not giving you a brush-off, “RTFM!!” response here.   There is a lot to read, and you really do need to read through all of it, at least once.   Because of the sheer volume of it, and because of the complexity of the thing that is being described, sometimes the jewel of information that you’re looking for is not in the first place that you looked.)

      i thought you could report errors via die by setting RaiseError => 1
Re: dbi raiseError = 1
by Anonymous Monk on Dec 21, 2010 at 00:41 UTC
    RaiseError doesn't return anything, it dies. More in the manual DBI
Re: dbi raiseError = 1
by thargas (Deacon) on Dec 21, 2010 at 12:55 UTC
    you want PrintError, with or without RaiseError depending on whether you want the program to die.