in reply to error catching

The cleanest way is to NOT do any explicit error handling. It may be better to handle your exceptions in one place, using "eval" and Exception::Class::DBI. So when you connect, you can pass this:
... RaiseError => 1, HandleError => Exception::Class::DBI->handler, ...
Now, if any error occurs, an exception will be thrown, and you can catch that via:
eval { # if I fail, I will let you know $dbh->do("evil query"); }; my $ex = undef; if ( $ex = Exception::Class::DBI->caught() ) { # log error in $ex->errstr # show users a general error screen }
This should also take care of any "connect" trouble.
In general, and totally IMHO, checking for return of every db statement is evil ;)