NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
{ RaiseError = 1 } (Score:1)
Reply to This
Re:{ RaiseError = 1 } (Score:1)
The best way I've found is to use RaiseError => 1, which tells DBI to always throw an exception when there is an error. This way, you never have errors go unnoticed. If you want an error to not be fatal, use eval.
eval {
$dbh->do("DROP TABLE users");
};
if ( $@ ) { my_error_handler( $@ ) }
Another method I use is a function that does a little more digging for me before printing it's error message.
sub check_dbi_erro