0

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__?

Grinnz
  • 9,093
  • 11
  • 18
Mike
  • 1,007
  • 2
  • 16
  • 33

1 Answers1

0

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>

UjinT34
  • 4,784
  • 1
  • 12
  • 26
  • Thanks. but changing to lower case didn't solve the problem. It is an old code and the only change was the Perl and mod_perl upgrade. – Mike Nov 22 '18 at 06:58
  • `loop_context_vars` is set to `false` by default – UjinT34 Nov 22 '18 at 07:21
  • How it is possible that I am getting a different behavior each time I am refreshing the page or it works fine with __FIRST__? How can I set it to true? – Mike Nov 22 '18 at 14:13