Catmandu::Exporter::Template3pm
A tt2 template exporter in catmandu style
Usage
# From the command lineecho '{"colors":["red","green","blue"]}' |catmandu convert JSON to Template --template `pwd`/xml.ttwhere xml.tt like:<colors>[% FOREACH c IN colors %]<color>[% c %]</color>[% END %]</colors># From perluse 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_afterprintf "exported %d objects\n" , $exporter->count;
Overview
This Catmandu::Exporter can be used to export records using Template Toolkit. If you are new to Catmandu see Catmandu::Tutorial.
Configuration
template
|
Required. Must contain path to the template. |
|---|---|
xml
|
Optional. Value: 0 or 1. Prepends xml header to the template. |
template_before
|
Optional. Prepend output to the export. |
template_after
|
Optional. Append output to the export. |
fix
|
Optional. Apply Catmandu fixes while exporting. |
[Template Toolkit configuration options]
|
You can also pass all Template Toolkit configuration options. |
Releases
4 releases since Debian 10 (Buster); the text changed 2 times.