Subject: | Bad parsing of INCLUDE directives |
I have two installations of Template Toolkit, 2.08 on Windows XP and
2.14 on Debian Linux. The first works fine, the second fails. Had it
have been the other way around I wouldn't have worried too much ;)
In the file main.html I have:
---- >8 cut here 8<----
<P>blah blah blah
[% IF data.location %][% INCLUDE "events/location-${data.location}.html"
%][% END %]
---- >8 cut here 8<----
The file events/location-oldjointstock.html contains:
---- >8 cut here 8<----
<P>blah blah blah
---- >8 cut here 8<----
If data.location contains the string "oldjointstock" the 2.14 version
balks in the apache log file with:
"undef error - Can't use string ("events/location-oldjointstock.ht") as
a HASH re
f while "strict refs" in use at
/usr/local/lib/perl/5.8.7/Template/Provider.pm l
ine 690."
but on the 2.08 version it renders the page fine.
even changing the include line to:
[% IF data.location %][% x = "events/location-${data.location}.html"
%][% INCLUDE $x %][% END %]
doesn't work either :(
However, if the file events/location-oldjointstock.html contains:
---- >8 cut here 8<----
<P>blah blah blah
---- >8 cut here 8<----
Note an additional blank line at the end, both versions work fine!
Aside from the error message being misleading, whether an include file
contains a blank line at the end or not, should not kill the parser.