sub get { my $self = shift; my $columns = ref $_[0] eq 'ARRAY' ? join(', ', @{ shift() }) : '*'; my $db_table = shift || croak "I really need to know DB/Table name"; my $field = @_ == 2 ? shift : 'id'; my $value = shift || croak "I really need key value"; my ($db, $table) = ($db_table =~ /^.+\..+$/) ? split(/\./, $db_table) : ($self->default_db(), $db_table); my $dbh = $self->dbh($db); my $sth = $dbh->prepare_cached("SELECT $columns FROM $table WHERE $field = ?", undef, 2); $sth->execute($value); my $resp = $sth->rows() ? $sth->fetchrow_hashref() : undef; return $resp; }