Text::TemplateFill is a Perl module for formatting of reports with templates from files, use for I18N.
SYNOPSIS
use Text::TemplateFill;
my $tmpl = new Text::TemplateFill;
$tmpl->SetOpt('BaseDir' => "paras/$Country");
$tmpl->SetOpt('ErrorFunction' => &LogMsg, 'LineTerminator' => "rn");
# Must read all the files before printing a paragraph
$tmpl->ReadPara('Header', "head");
$tmpl->ReadPara('FirstPage');
$tmpl->ReadPara('Footer');
$tmpl->ReadPara('Body');
$tmpl->SetOpt('StartPageTag' => 'Header');
my ($a, $b, $cn, $d) = ('a', 'letter b', 'ACME Inc', 4.92);
$tmpl->BindVars('NameOfA' => $a, 'B' => $b, 'CustomerName' => $cn, 'VarD' => $d);
print $tmpl->GeneratePara('FirstPage'); # Optional - since we want a specific 1st page
print $tmpl->GeneratePara('Body');
... $a = ...; $b = ...
print $tmpl->GeneratePara('Body');
print $tmpl->CompletePage;
Here are some key features of "Text TemplateFill":
· I18N formatting support, eg: decimal comma in France
· I18N date support
· Automatic page breaks
· Variables are 'registered', not passed to each GeneratePara
· Items of text (paragraphs) that are output are initially read from a text file.
· Calculations may be defined as part of the paragraph definition in the file.
· Optional use of your own Error reporting code
· Variables can be formatted by the full power of printf
· Automatic page/paragraph counting
· Output is a string that may be then written anywhere
Requirements:
· Perl
Product's homepage