NAME
Data::Tubes::Plugin::Renderer
DESCRIPTION
This module contains factory functions to generate tubes that ease rendering records as text (or data).
Each of the generated tubes has the following contract:
the input record MUST be a hash reference;
one field in the input record (according to factory argument
input, set tostructuredby default) indicates which input field contains variables for expansion;one field in the hash (according to factory argument
output, set torenderedby default) is set to the output of the reading operation.
The factory functions below have two names, one starting with render_ and the other without this prefix. They are perfectly equivalent to each other, whereas the short version can be handier e.g. when using tube or pipeline from Data::Tubes.
FUNCTIONS
- with_template_perlish
- render_with_template_perlish
-
my $tube = with_template_perlish(%args); # OR my $tube = with_template_perlish(\%args);render input variables using a Template::Perlish template.
Allowed arguments are:
input-
the name of the input field in the record, where record-specific variables can be found;
name-
the name of the tube, useful when debugging;
output-
the name of the output field in the output record;
start-
parameter for Template::Perlish, defaults to
[%; stop-
parameter for Template::Perlish, defaults to
%]; template-
template that will be expanded, MUST be compliant with the rules explained in Template::Perlish and the setting above for "start" and "stop";
variables-
hash reference with variables that will always be available when expanding the template.
BUGS AND LIMITATIONS
Report bugs either through RT or GitHub (patches welcome).
AUTHOR
Flavio Poletti <polettix@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2016 by Flavio Poletti <polettix@cpan.org>
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.