A while ago I went for a package with all the SQL in and an abstraction layer, CRDB which sits on top of DBI, takes a statement title and returns the results.
Works quite well for a system that doesnt have masses of SQL.
package CRSql;
use strict;
use vars qw ( %SQL ) ;
%SQL = (
sys => q{
select count(*) from user_tables
},
donation_count => q{
select count(*) from donation
},
);
#------------------------------------
use CRSql;
use CRDB;
my $crdbh = CRDB->login('****', '****', '****', $FALSE);
Log::write('FATAL', "DB connection failed \n") unless (ref($crdbh) eq
+'CRDB');
$crdbh->sql(\%CRSql::SQL);
my ($cols, $ref) = $crdbh->as_list('donation_count', 'A');