Template::Like - Lightweight Template Engine.
#!/usr/bin/perl use lib 'lib'; use strict; use Template::Like; my $input = q{ [% var %] [% FOREACH var = vars %] - [% var.name %] [% END %] [% var %] [% IF bool %]TURE!![% ELSE %]FALSE!![% END %] [% UNLESS bool %]TURE!![% ELSE %]FALSE!![% END %] }; my $param = { var => "HOGE", vars => [ { name => "FOO" }, { name => "BAR" } ], bool => 1 }; my $t = Template::Like->new; my $output = ""; $t->process(\$input, $param, \$output); print $output; exit;
result
HOGE - FOO - BAR HOGE TURE!! FALSE!!
official http://www.template-like.org
Template
Shinichiro Aska, <askadna@cpan.org>
Copyright (C) 2007 by Shinichiro Aska
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install Template::Like, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Like
CPAN shell
perl -MCPAN -e shell install Template::Like
For more information on module installation, please visit the detailed CPAN module installation guide.