use DBI;
use HTML::Template;
my $dbh = DBI->connect(
qw(DBI:vendor:database:host user pass),
{RaiseError=>1},
);
my $things = $dbh->selectall_arrayref('
SELECT id,name
FROM status
',{Slice=>{}});
# optionally do more things to some of the fields
# yes, we do have to say their names again
$_->{id} = sprintf("%03d",$_->{id}) for @$things;
my $tmpl = HTML::Template->new(filehandle => \*DATA);
$tmpl->param(things => $things);
print $tmpl->output;
__DATA__
: