I have to show report from a database of a daily report of ids. I have
simplified the code here

Pasted at http://pastebin.com/v0XmMuZP

#!/usr/bin/perl
use strict;
use Template;
use CGI;

# Everyday report from DB for each id
#
my %report = (
    '2010-12-01' => { 1 => 'OK' , 2 => 'FAIL' , 4 => 'FAIL' , 5 => 'OK' },
    '2010-12-02' => { 1 => 'OK' , 2 => 'FAIL' , 3 => 'OK'   , 5 => 'OK' },
    '2010-12-03' => { 1 => 'OK' , 2 => 'FAIL' , 3 => 'OK'   , 4 => 'OK' },
     ....
     ....
    );

my $cgi = new CGI;
$startdate = $cgi->param('start');
$enddate = $cgi->param('end');
my @ids = ( 1 ,2 ,3,4,5);
my %tag;
$tag{ids...@ids;

#This function returns array ref of daterange
$tag{dates}= date_range($startdate,$enddate);

# ...  What do I do here ?
# ...

my $tt = Template->new();
$tt->process(\*DATA,\%tag) || die $tt->error();


__DATA__
Expected output is
ID        Date1      Date2  ..... DateN
1         OK         FAIL
2         FAIL       FAIL
3         -          OK
4         OK         -
5         OK         -

I have use template toolkit before but where there were always variable
number of rows
I dont know before hand how many columns will they contain here. Can someone
help me

-- 
Thanks
Ram
  <http://www.netcore.co.in/>




n <http://pragatee.com>

Reply via email to