#!/usr/bin/perl -w
use strict;
use CGI;
use HTML::Template;
my $q = new CGI;
my $t = HTML::Template->new(filename=>'index.tmpl', path=>'tmpl', cache=>1);
################################################################################
## main
################################################################################
use DBI;
my $dbh = DBI->connect('dbi:mysql:chip:chipperdb.chip.org', 'chipwww', 'pr1vate');
my $sql = qq(SELECT board_id, article_id, title, DATE_FORMAT(created, '%c/%e/%Y') as date FROM bw_xboard_header WHERE board_id=1 ORDER BY article_id DESC limit 5);
my $rv = $dbh->selectall_hashref($sql, 'article_id');
my @rv = map { \%{ ${$rv}{$_} } } sort { $b <=> $a } keys %$rv;
$t->param(news=>\@rv);
my @files = ;
$t->param(people=>$files[ int rand @files ]);
################################################################################
print $q->header;
print $t->output;