CSV::Template is a subclass of HTML::Template that does some minor post processing of the output. Since HTML::Template really just operates on plain text, and not HTML specifically, it dawned on me that there is no reason why I should not use HTML::Template (and all my HTML::Template friendly data structures) to generate my CSV files as well.
Now this is by no means a full-features CSV templating system. Currently it serves my needs which is to display report output in both HTML (with HTML::Template) and in CSV (to be viewed in Excel).
SYNOPSIS
use CSV::Template;
my $csv = CSV::Template->new(filename => "templates/test.tmpl");
$csv->param(report_title => $csv->quote_string('My "Report"'));
$csv->param(report_data => [
{ one => 1, two => 2, three => 3 },
{ one => 2, two => 4, three => 6 },
{ one => 3, two => 6, three => 9 },
]);
print $csv->output();
Product's homepage
Requirements:
· Perl