[htmltmpl] Parsing bug under Perl 5.6.1, and a fix
Brought to you by:
samtregar
From: Josh C. <jos...@mi...> - 2006-05-23 09:53:20
|
Here's a strange bug that I encountered while running HTML::Template 2.8 under Perl 5.006001 (doesn't happen in the various flavors of 5.8 that I've tried). When using a scalar reference template, HTML::Template dies on the first TMPL_XXX tag that it encounters: "Unknown or unmatched TMPL construct at /fake/path/for/non/file/template" I tweaked the error string to include the value of $which when it dies, and I discovered that the TMPL_ portion of the first tag was always replaced by F0B5, no matter what the original tag. For example: TMPL_VAR --> F0B5VAR TMPL_INCLUDE --> F0B5INCLUDE TMPL_IF --> F0B5IF etc. The problem appears to be related to the uc function in line 1969: $which = uc($1); # which tag is it Doing something with $1 (e.g. printing it or assigning it to a variable) before calling the uc function fixes the problem. $which = $1; $which = uc($1); # which tag is it After making that change, the problem goes away and the template string is parsed as usual. All best, Josh |