sub main { use Data::Dumper; my $self = shift; my $q = $self->query; # create our CGI object my $thread_id; my $dbh = WebApp::DBI->connect("root", "***"); my $sth = $dbh->prepare(q{ select subject, author, date, content, id from dh_journal where id = ? order by date desc limit 5 }); my (@rows, %row_data); $sth->bind_columns( \( @row_data{ @{$sth->{NAME_lc} } } )); $sth->execute($thread_id); push @rows, { %row_data } while $sth->fetch; my $tmpl = $self->load_tmpl( 'main.html', loop_context_vars =>1, associate => $q, filter => sub { my $ref = shift; $$ref =~ s||(times())[0]|eg; # currently <4ms (Oct 3 2005)} ); $tmpl->param( rows => \@rows); return $tmpl->output; } ### TEMPLATE SIDE (SAMPLE) ####

Subject:

Author:

Date:

Content:

ID: