Skip Menu |

This queue is for tickets about the HTML-Template CPAN distribution.

Report information
The Basics
Id: 1242
Status: resolved
Priority: 0/
Queue: HTML-Template

Owner: Nobody in particular
Requestors: tjmather [...]

Bug Information
Severity: Normal
Broken in: 2.5
Fixed in: (no value)

Subject: global_vars broken for loops inside loops
Download (untitled) / with headers
text/plain 887b
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> #!/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
Download (untitled) / with headers
text/plain 157b
I've documented this in 2.7. I plan to fix this in v3, but the fix won't be backwards compatible with all possible usages, so I don't want to put it in 2.7.
This is now fixed for v2.9 in a mostly backwards compatible way.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to