##
#!/usr/bin/perl -w
use strict;
use diagnostics;
use HTML::Template;
use Data::Table;
use DBI;
# open( OUT, ">snow.html" ) or die "cant open out $!";
my $dbh = DBI->connect( 'dbi:AnyData(RaiseError=>1):' or die $DBI::errstr );
$dbh->func(
'whthr', 'CSV',
'wheather.csv',
{
sep_char => ',',
# eol => "\015",
col_names => 'day,type'
},
'ad_catalog'
);
my $table = Data::Table::fromSQL( $dbh,
"SELECT day, type FROM whthr WHERE type='snow'" );
print $table->html; # not the preferred formatting
print $table->csv; # ?
# for my $row (@rows) {
# push( @loop_data, {FILES => $row} );
# }
# Can I use the object $table for the $template of HTML::Template?
# my $template = HTML::Template->new( filename => 'template_whthr.tmpl' );
# print OUT $template->output;
##
##