I have the following line in my tmpl file:
<td><TMPL_LOOP SIGNS><TMPL_VAR LEFT_SIGN> - <TMPL_VAR RIGHT_SIGN><TMPL_UNLESS __LAST__></br></TMPL_UNLESS></TMPL_LOOP></td>
When refreshing the page it switches between both displays (sometimes refresh leads to the same display and not necessarily switch it):
Display1 (new line between each line - as expected):
AA1 - AA2
BB1 - BB2
CC1 - CC2
Display2 (no new line between the last item):
AA1 - AA2
BB1 - BB2CC1 - CC2
Recently I upgraded Perl to version 5.24.3 and I suspect that __LAST__
stop working as expected (no always recognize the last item in the loop).
I am using the module "HTML::Template".
I changed the html to (__FIRST__
instead of __LAST__
):
<td><TMPL_LOOP SIGNS><TMPL_UNLESS __FIRST__></br></TMPL_UNLESS><TMPL_VAR LEFT_SIGN> - <TMPL_VAR RIGHT_SIGN></TMPL_LOOP></td>
and it works always as expected.
I couldn't find any reference to this issue.
Is it really a bug with __LAST__
?
If you are using HTML::Template then check the documentation. You might need to set
loop_context_vars
option and use lowercase__last__
or__first__
. I guess that code with__FIRST__
works because it always outputs<br>