#!C:/Perl/bin/perl.exe
use strict;
use HTML::Template;
use CGI;
my $cgi = new CGI;
my $the_file = $cgi->param('param1');
my @reportdata = ();
my $id=0;
my $template = HTML::Template->new(filename => '..\\htdocs\\dropui\\showfile.tmpl');
if (open(THE_FILE, "$the_file"))
{
while ()
{
my %row_data; # get a fresh hash for the row data
my %test_row;
# fill in this row
@fields = split(/\*\*/,$_);
if ($id == 0){
$test_row{FID} = $id++;
$test_row{FTYPE} = shift @fields;
$test_row{FHEADER} = shift @fields;
$test_row{FLINK} = shift @fields;
$test_row{FSYSTEM} = shift @fields;
$test_row{FBLA} = shift @fields;
}
else{
$row_data{ID} = $id++;
$row_data{TYPE} = shift @fields;
$row_data{HEADER} = shift @fields;
$row_data{LINK} = shift @fields;
$row_data{SYSTEM} = shift @fields;
$row_data{BLA} = shift @fields;
}
push(@reportdata, \%row_data, \%test_row);
}
close(THE_FILE);
}
# finally, assign the loop data to the loop param, again with a
# reference:
$template->param(THIS_LOOP => \@reportdata);
# send the obligatory Content-Type
print "Content-Type: text/html\n\n";
# print the template
print $template->output;
exit(0);