##
$s->ar = $sth->fetchall_arrayref({});
$s->rows = @{$s->ar};
####
# Assume $sth is a valid statement handle
my $params = $sth->fetchall_arrayref({});
my $template = new HTML::Template (filename => 'file.name');
$template->param(TABLENAME => $params);
print $template->output();
####