I wrote something about SQL::Abstract in this recent article, so I will now show the features of a small module which works perfectly well with the above mentioned one, but also without it: DBIx::Simple. This package provides a nicer interface to DBI, and allows to use SQL::Abstract to build queries (but does not require it).
DBI works just fine, but it sometimes gets boring to write the code which uses it: most of time you have to prepare_cached your query and then execute it; to retrieve the data you have to use fetchall_arrayref or one of the similar long-named methods, often passing them the needed parameters. DBIx::Simple makes all of this... simpler. For example, if you need to fetch some rows into an hashref you just write:
use DBIx::Simple;
my $db = DBIx::Simple->new(
'dbi:mysql:database=mydb;host=myhost', 'myuser', 'mypass'
);
my $res = $db->query(
'select id, username, address from users where role = ?',
'customer'
);
my $rows = $res->hashes;