Subject: | global_vars broken for loops inside loops |
For HTML-Template-2.5, using Perl v5.6.1 on Linux 2.4.7:
global_vars doesn't seem to work for loops inside loops. Here's an example:
test.tmpl:
<TMPL_LOOP NAME="a">
<TMPL_LOOP NAME="b">
<TMPL_VAR NAME="c">
</TMPL_LOOP>
</TMPL_LOOP>
test.pl:
#!/usr/bin/perl
use HTML::Template;
my $template = HTML::Template->new(
filename => 'test.tmpl',
global_vars => 1,
die_on_bad_params => 0,
);
$template->param('a' => [ { c => 'i am c', b => [ {d => 1}] } ]);
print $template->output;
output:
<blank lines>
Note that if you "declare" the variable in the outer loop, then it works:
test.tmpl:
<TMPL_LOOP NAME="a">
<TMPL_VAR NAME="c">
<TMPL_LOOP NAME="b">
<TMPL_VAR NAME="c">
</TMPL_LOOP>
</TMPL_LOOP>
output:
i am c
i am c