possible bug

Michael Peters <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
I don't know if this is a bug or not, but it seems strange to me. I have
die_on_bad_params set and a loop that appears twice in the template. In one
version of this loop there are variables that are not in the other. But when I
try to use the template, I get the standard " Attempt to set nonexistent parameter".

Now, query() shows that the loop contains the variable, since at least one
version does have it. I've attached an example. Is this expected behavior?

-- 
Michael Peters
Developer
Plus Three, LP
test.pl (application/x-perl, 643 B)
#!/usr/bin/perl
use strict;
use warnings;
use HTML::Template;

my $tmpl = qq(
    LOOP 2
    <tmpl_loop stuffs>
      Stuff      => <tmpl_var stuff>
      More Stuff => <tmpl_var more_stuff>
    </tmpl_loop>

    LOOP 1
    <tmpl_loop stuffs>
      Stuff => <tmpl_var stuff>
    </tmpl_loop>

);
my $ht = HTML::Template->new(
    scalarref         => \$tmpl,
    die_on_bad_params => 1,
);

$ht->param(
    stuffs => [
        { 
            stuff       => 'asdf',
            more_stuff  => 'qwerty',
        },
        { 
            stuff       => 'asdf 2',
            more_stuff  => 'qwerty 2',
        },
    ],
);

print $ht->output;
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.