Valiant::Filter::Template - Flatten a Hashref into a string via a template pattern
package Local::Test; use Moo; use Valiant::Filters; has 'info' => (is=>'ro', required=>1); filters 'info', template => 'Hello {{name}}, you are {{age}} years old!'; my $object = Local::Test->new( info => +{ name => 'John', age => '52', } ); $object->info; # Hello John you are 52 years old!'
Given a hashref value, using a template create a string. This isn't a very sophisticated templating system, and it won't throw errors if hash keys are missing.
This filter defines the following attributes
The template string
Valiant, Valiant::Filter, Valiant::Validator::Filter.
See Valiant
To install Valiant, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Valiant
CPAN shell
perl -MCPAN -e shell install Valiant
For more information on module installation, please visit the detailed CPAN module installation guide.