Category Archives: databases

Set custom DBI error handlers

The DBI module lets you handle errors yourself if you don’t like its built-in behavior. DBI lets you handle the errors at either the database or the statement handle level by specifying attributes: my $dbh = DBI->connect( …, …, \%attr ); my $sth = $dbh->prepare( …, \%attr ); There are several attributes that affect error [...]

Use DBI_TRACE to follow DBI’s work.

There is a lot going on when you use DBI to interact with a database. Tack on a few layers of abstraction from Object Relational Modelers (ORM’s) such as DBIx::Class and you can end up with a tricky maze of subroutine calls to dig through when you need to track down issues. DBI comes with [...]