my @rows = (); # H::T can create a looping structure out of # an array of hashes # the keys for each hash are the variable # names for each row of the loop # add database stuff here while(my $ref = $sth->fetchrow_hashref()) { # you can mangle whats in ref, I often # just push the ref onto the array and try to # put my already mangled stuff in the database # This only works though if the variable names in # the template are the same as your DB column names push(@rows,$ref); } my $template = HTML::Template->new(filename=>'/path/to/some.tmpl'); # H::T expects a reference to the array $template->param(wines=>\@rows); # print your header (CGI or CGI::Simple is still useful for this) print $cgi->header(); # and then your H::T output print $template->output(); ####
Wine Country Bottles