A Perl script to produce a HTML report with a report template

The script

#!/usr/bin/perl
# marul-stem.pl - read in a HTML template a file formatted by csvstem2html.pl
# usage: perl marul-stem.pl filename
use strict;
use warnings;
use HTML::Template;
use DateTime;
use File::Slurp 'read_file';
 
# print current date:
my $now = DateTime->now->ymd;
my $filenam  = shift or die 'filename!';
my $tbl = read_file $filenam;
# use template marul-stem.tpl
my $template = HTML::Template->new(filename => 'marul-stem.tpl');
$template->param(
TABLICA => $tbl,
TEMPUS => $now,
);
print $template->output;

The template

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Formae Textoris in CroALa</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p.subtitle {
        font-size: large;
font-style:italic;
color:#999966;
}
span.fin {
	color:#999966;
	font-size: small;
	vertical-align: super;
	}
td {font-family: monospace; font-size: large; }
tr:nth-child(even) {
    background-color: #F5F5F5;
}
</style>
</head>
<body text="#000000">
<h1>Formae Textoris in CroALa et apud Pannonium quaerendae.</h1>
 
<p><a href="http://profilecroatianneolatin.blogspot.com/">Forma Latinitatis Croaticae</a>, <!-- TMPL_VAR NAME=TEMPUS -->.</p>
<p class="subtitle">Littera A</p>
<blockquote>
<table width="100%" rules="rows">
<tr><td>No.</td> <td>Lemma</td> <td>Forma</td> <td align="right">Quoties in Pannonio?</td> <td>&nbsp;</td> <td>Quaere!</td> <td align="right">Quoties in CroALa?</td> <td>&nbsp;</td> <td>Quaere!</td></tr>
 
 
<!-- TMPL_VAR NAME=TABLICA -->
</table>
<p/>
<hr/>
<div>
<p><span class="fin">Anno MMXI </span><img src="http://gap.alexandriaarchive.org/gapvis/images/google_logo.png" alt="Google"/><span class="fin"> pecuniam dedit.</span></p>
</div>
</body>
</html>
 
z/croala-report-template.txt · Last modified: 04. 11. 2012. 18:18 by njovanov
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki