sub select { my ($self, $want, $query, @args) = @_; die "Not connected to a database!" unless defined $self->{'dbh'}; my $results; if (ref $want eq "HASH") { my $sth = $self->{'dbh'}->prepare("SELECT $query"); $sth->execute(@args); while (my $row = $sth->fetchrow_hashref()) { push @{$results}, { map { $_, $row->{$_} } keys %{$row} }; } } elsif (ref $want eq "ARRAY") { $results = $self->{'dbh'}->selectall_arrayref("SELECT $query", {}, @args); undef $results if $#{$results} < 0; } return $results; }