(Tested with HTML::Template 2.8 and 2.9)

The following looks like a bug to me:

Program:
+++++++++++++++++++++++++++++++++++++++++++++++++
#!/usr/bin/perl -w
use HTML::Template;

my $template = <<EOF;
<TMPL_LOOP NAME=diff>
 <TMPL_LOOP NAME=Drop>first</TMPL_LOOP>
 <TMPL_LOOP NAME=Mapping >
  <TMPL_LOOP NAME=Drop>second</TMPL_LOOP>
 </TMPL_LOOP>
</TMPL_LOOP>
EOF

my $t = HTML::Template->new_scalar_ref(\$template, global_vars => 1);
$t->param
    (diff => [{
        # Drop => [{}],
        'Mapping' => [{}],
    }],);
print $t->output;
-------------------------------------------------

Gives as result:

+++++++++++++++++++++++++++++++++++++++++++++++++
HTML::Template->output() : fatal error in loop output : 
HTML::Template->output() : fatal error in loop output : HTML::Template::param() 
: attempt to set parameter 'drop' with a scalar - parameter is not a TMPL_VAR! 
at /usr/lib/perl5/site_perl/5.8.4/HTML/Template.pm line 2998
 at /usr/lib/perl5/site_perl/5.8.4/HTML/Template.pm line 2998
 at ./test.pl line 19
-------------------------------------------------

So the first TMPL_LOOP NAME=Drop somehow destroys the the working of the second
one. Removing either of these loops makes everything work. Also removing the
outer diff level in the template text and the params makes it work. Also 
removing global_vars => 1 makes this work

Uncommenting the 
# Drop => [{}],
line in the code makes the output be:

+++++++++++++++++++++++++++++++++++++++++++++++++

 first

  second


-------------------------------------------------

That is also wrong I think since the docs are quite clear that there isn't
supposed to be a "global_loops" implied by global_vars. Only "first" should
have printed.
-- 
Your money back if not satisfied!
(However, we suspect that we will be quite satisfied with your money)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to