I just released version 1.00 of HTML::Table::FromDatabase, with a new row_callbacks feature.
You could already declare callbacks on a cell-level basis, so you could say, format monetary values appropriately, round numeric columns, turn URLs into clickable links etc. Now, you can also declare a callback which receives an entire row as a hashref, which it can modify as needed.
An (admittedly somewhat contrived) example from the documentation:
my $table = HTML::Table::FromDatabase->new(
-sth => $sth,
-row_callbacks => [
sub {
my $row = shift;
if ($row->{name} eq 'Bob') {
# Hide this row
$row = undef;
} elsif ($row->{name} eq 'John') {
# John likes to be called Jean these days:
$row->{name} = 'Jean';
}
},
],
);
I decided to bump the version to 1.00 for the sake of anyone who considers 0.x versions to be unready for production use; this module has been about since 2008 and is working well in production use for me.
If you liked that post, then try these...
pQuery - jQuery-like fun in Perl
Lyrics::Fetcher 0.3.2 released