Bug in die_on_bad_params handling

Matija Grabnar <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
For example
Template:

<tmpl_loop name="foo">
  <tmpl_var name="bar">
  <tmpl_var name="baz">
</tmpl_loop>
<tmpl_loop name="foo">
  <tmpl_var name="baz">
</tmpl_loop>

Script:
#!/usr/bin/perl
use HTML::Template;
$t=HTML::Template->new(filename=>'0.tmpl');
@foo=({bar=>1,baz=>2},{bar=>3,baz=>4});
$t->param(foo=>\@foo);
print $t->output;

Result:
HTML::Template->output() : fatal error in loop output : HTML::Template : 
Attempt to set nonexistent parameter 'bar' - this parameter name doesn't 
match any declarations in the template file : (die_on_bad_params => 1) 
at /usr/share/perl5/HTML/Template.pm line 2905
 at 0.pl line 6
 at /usr/share/perl5/HTML/Template.pm line 2613
        HTML::Template::output('HTML::Template=HASH(0x81f283c)') called 
at 0.pl line 6

Obviously, this error is wrong: bar does appear, just not in EVERY 
instance of the loop. I could
turn die_on_bad_params off, but then I don't get help in finding REAL 
errors, and I need it
(because the actual template where I need this is much, much more 
complex than this
example).


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.