I'm no expert so I can't tell you why my last example didn't work (hopefully someone will jump in).
Try the following -
sub {
my ($table, $field, $value) = @_;
my $obj = $DB->table($table);
$obj->select_options ('ORDER BY field_name');
my $sth = $obj->select({ $field => $value });
my @output;
while (my $rs = $sth->fetchrow_hashref ) {
push @output, $rs;
}
return { loop_hash => \@output };
}
Simon
Try the following -
sub {
my ($table, $field, $value) = @_;
my $obj = $DB->table($table);
$obj->select_options ('ORDER BY field_name');
my $sth = $obj->select({ $field => $value });
my @output;
while (my $rs = $sth->fetchrow_hashref ) {
push @output, $rs;
}
return { loop_hash => \@output };
}
Simon