Catmandu::Exporter::Template - a TT2 Template exporter
use Catmandu::Exporter::Template; my $exporter = Catmandu::Exporter::Template->new( fix => 'myfix.txt' xml => 1, template_before => '<path>/header.xml' , template => '<path>/record.xml' , template_after => '<path>/footer.xml' , ); $exporter->add_many($arrayref); $exporter->add_many($iterator); $exporter->add_many(sub { }); $exporter->add($hashref); $exporter->commit; # trigger the template_after printf "exported %d objects\n" , $exporter->count;
Catmandu::Exporter::Template can be used to export data objects using Template Toolkit. The only required argument is 'template' which points to a file to render for each exported object. Set the 'template_before' and 'template_before' to add output at the start and end of the export. Optionally provide an 'xml' indicator to include a XML header.
Commit all changes and execute the template_after if given.
Catmandu::Exporter, Template
To install Catmandu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu
CPAN shell
perl -MCPAN -e shell install Catmandu
For more information on module installation, please visit the detailed CPAN module installation guide.