in reply to Re^2: Looking for a "Template Engine"
in thread Looking for a "Template Engine"
Let me show you how hard it is to work with Template for the example you gave.
the Perl script
use strict; use warnings; use Template; my $template = Template->new({ INCLUDE_PATH => '.', EVAL_PERL => 1, }) || die $!; my $foo = foo(3,5); my @s = ('this', 'that'); $template->process("tpl.txt", {foo => $foo, s => \@s}) || die $templat +e->error(); sub foo { $_[0]+$_[1] }
the template file
This is some line. This is a line with some expression: [% foo %] [% FOREACH l = s %] This is [% l %] line [% END %] This is the end
btw. It's up to you to make your code readable. If you have arrays, you'll have to cycle through its elements. Template is not to blame.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Looking for a "Template Engine"
by rovf (Priest) on Jul 22, 2008 at 13:00 UTC | |
by karavelov (Monk) on Jul 22, 2008 at 15:27 UTC | |
by rovf (Priest) on Jul 23, 2008 at 08:03 UTC |