Shawn Scott
2010-04-08 21:20:36 UTC
Good Afternoon,
I have been using HTML::Template for some time and have recently run into an
starnge issue. I have the following code
my @error = @_;
my @error_loop = ();
my %error_data;
print header;
foreach (@error) {
$error_data{ERROR_DATA} = $_;
push(@error_loop, \%error_data);
}
my $template = HTML::Template->new(filename =>
"$html_root/signup_error.html");
$template->param(ERROR_LOOP => \@error_loop);
print $template->output;
When I run this code it gives me the correct number of elements, based on
the number of errors in the loop @error array. The only issue each one is
shown as the last line pushed to the @error_loop. If I change the code to
this
foreach (@error) {
print p"DEBUG - $_\n";
$error_data{ERROR_DATA} = $_;
push(@error_loop, \%error_data);
}
I get the correct vaules printing out in the debug print line but then the
actual template loop variables are wrong.
Any help would be great.
I have been using HTML::Template for some time and have recently run into an
starnge issue. I have the following code
my @error = @_;
my @error_loop = ();
my %error_data;
print header;
foreach (@error) {
$error_data{ERROR_DATA} = $_;
push(@error_loop, \%error_data);
}
my $template = HTML::Template->new(filename =>
"$html_root/signup_error.html");
$template->param(ERROR_LOOP => \@error_loop);
print $template->output;
When I run this code it gives me the correct number of elements, based on
the number of errors in the loop @error array. The only issue each one is
shown as the last line pushed to the @error_loop. If I change the code to
this
foreach (@error) {
print p"DEBUG - $_\n";
$error_data{ERROR_DATA} = $_;
push(@error_loop, \%error_data);
}
I get the correct vaules printing out in the debug print line but then the
actual template loop variables are wrong.
Any help would be great.