package SmallProject::Database; use base 'DBIx::Simple'; sub connect { my $self = shift; $self->SUPER::connect('dbi:...', 'u', 'p', { RaiseError => 1}); } sub foo { my $self = shift; my ($where, @binds) = $self->abstract->where({ @_ }); $self ->query("SELECT * FROM foo WHERE $where LIMIT 1", @binds) ->hash; } # This could be simpler if SQL::Abstract supported LIMIT clauses: # sub foo { # my $self = shift; # $self->select(foo => '*', { @_ }, \1); # } sub foos { my $self = shift; $self->select(foo => '*', { @_ })->hashes; } 1;