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.
Add data to the exporter.
Commit all changes and execute the template_after if given.
Nicolas Steenlant <nicolas.steenlant@ugent.be>
Vitali Peil <vitali.peil@uni-bielefeld.de>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Catmandu::Exporter, Template
To install Catmandu::Exporter::Template, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::Exporter::Template
CPAN shell
perl -MCPAN -e shell install Catmandu::Exporter::Template
For more information on module installation, please visit the detailed CPAN module installation guide.