Subject: | HTML::Template::Expr seems to fail some shallow parts of tree since version 0.6 |
Date: | Wed, 2 Nov 2016 02:23:45 +0000 (UTC) |
To: | "bug-HTML-Template-Expr [...] rt.cpan.org" <bug-HTML-Template-Expr [...] rt.cpan.org> |
From: | Georgy Vladimirov <georgyvv [...] yahoo.com> |
Hi folks,
I was just troubleshooting an installation at work and figuring out why some values weren't populating on our templates in a new CentOS 6 installation. I compared the "HTML::Template::Expr" version "0.07" we had on the old CentOS 5 server against the same "0.07" version we have on the new CentOS 6 server and I discovered that someone must have made a fix on the old machine that wasn't documented and I had to discover the hard way...
Basically, the fix is this patch:200c200
< my @stack = @$tree;
---
Show quoted text
> my @stack = ($tree);
This inside this sub: _expr_vars
I noticed that since version "0.06" the module switched from: while(@_) {
my $node = shift;
To this: my $tree = shift;
my @stack = @$tree;
while (@stack) {
my $node = shift @stack;
The fact that we grab the elements of $tree into the @stack, instead of grabbing the $tree itself into the @stack, causes the shallow levels not to render. In addition, I get a few warnings that I think are related to this problem:Use of uninitialized value $_ in substitution (s///) at /usr/local/share/perl5/HTML/Template.pm line 2801.
Use of uninitialized value $_ in substitution (s///) at /usr/local/share/perl5/HTML/Template.pm line 2802.
Use of uninitialized value $_ in substitution (s///) at /usr/local/share/perl5/HTML/Template.pm line 2803.
Use of uninitialized value $_ in substitution (s///) at /usr/local/share/perl5/HTML/Template.pm line 2804.
Use of uninitialized value $_ in substitution (s///) at /usr/local/share/perl5/HTML/Template.pm line 2805.
Use of uninitialized value $_ in concatenation (.) or string at /usr/local/share/perl5/HTML/Template.pm line 2807.
Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/HTML/Template.pm line 2713.
Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/HTML/Template.pm line 2713.
Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/HTML/Template.pm line 2713.
Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/HTML/Template.pm line 2713.
I don't fully understand the way the module works but it seems like this might be a bug and the patch that someone had come up with may be a good one...
Here are details about the versions we use (some XXX redactions):OS:
# uname -u
Linux XXXXX 2.6.32-573.12.1.el6.x86_64 #1 SMP Tue Dec 15 21:19:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Parent module versions used and tested with:/usr/local/share/perl5/HTML/Template.pm
package HTML::Template;
$HTML::Template::VERSION = '2.95';
/usr/lib/perl5/site_perl/5.8.5/HTML/Template.pm
package HTML::Template;
$HTML::Template::VERSION = '2.9';
The HTML::Template::Expr module versions used:/usr/local/share/perl5/HTML/Template/Expr.pm
package HTML::Template::Expr;
$VERSION = '0.07';
use HTML::Template 2.4;
/usr/lib/perl5/site_perl/5.8.5/HTML/Template/Expr.pm
package HTML::Template::Expr;
$VERSION = '0.07';
use HTML::Template 2.4;
The Perl version on one of my machines (where I was trying to get the same code run like in the old one) is:# perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
PERL VERSION ] IS: 5.010001
PERL VERSION V IS: v5.10.1
On the old machine I had something like 5.8.8
Thank you for maintaining the module and I hope that this information helps, if the module indeed has a problem...
Yours,
Georgy.