“__LAST__” (in tmpl_if) not always works in Perl HTML::Template












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










share|improve this question

























  • What library do you use that provides the __LAST__? It's not part of Perl itself.

    – choroba
    Nov 21 '18 at 13:36











  • do you mean to "HTML::Template"?

    – Mike
    Nov 21 '18 at 13:39








  • 4





    Please edit your question and add the relevant, minimal Perl code to reproduce the output. Minimal, Complete, and Verifiable example

    – Corion
    Nov 21 '18 at 13:39


















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










share|improve this question

























  • What library do you use that provides the __LAST__? It's not part of Perl itself.

    – choroba
    Nov 21 '18 at 13:36











  • do you mean to "HTML::Template"?

    – Mike
    Nov 21 '18 at 13:39








  • 4





    Please edit your question and add the relevant, minimal Perl code to reproduce the output. Minimal, Complete, and Verifiable example

    – Corion
    Nov 21 '18 at 13:39
















0












0








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










share|improve this question
















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







perl perl-html-template






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 0:30









Grinnz

3,311514




3,311514










asked Nov 21 '18 at 13:22









MikeMike

51421023




51421023













  • What library do you use that provides the __LAST__? It's not part of Perl itself.

    – choroba
    Nov 21 '18 at 13:36











  • do you mean to "HTML::Template"?

    – Mike
    Nov 21 '18 at 13:39








  • 4





    Please edit your question and add the relevant, minimal Perl code to reproduce the output. Minimal, Complete, and Verifiable example

    – Corion
    Nov 21 '18 at 13:39





















  • What library do you use that provides the __LAST__? It's not part of Perl itself.

    – choroba
    Nov 21 '18 at 13:36











  • do you mean to "HTML::Template"?

    – Mike
    Nov 21 '18 at 13:39








  • 4





    Please edit your question and add the relevant, minimal Perl code to reproduce the output. Minimal, Complete, and Verifiable example

    – Corion
    Nov 21 '18 at 13:39



















What library do you use that provides the __LAST__? It's not part of Perl itself.

– choroba
Nov 21 '18 at 13:36





What library do you use that provides the __LAST__? It's not part of Perl itself.

– choroba
Nov 21 '18 at 13:36













do you mean to "HTML::Template"?

– Mike
Nov 21 '18 at 13:39







do you mean to "HTML::Template"?

– Mike
Nov 21 '18 at 13:39






4




4





Please edit your question and add the relevant, minimal Perl code to reproduce the output. Minimal, Complete, and Verifiable example

– Corion
Nov 21 '18 at 13:39







Please edit your question and add the relevant, minimal Perl code to reproduce the output. Minimal, Complete, and Verifiable example

– Corion
Nov 21 '18 at 13:39














1 Answer
1






active

oldest

votes


















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>






share|improve this answer
























  • 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 6:58













  • loop_context_vars is set to false by default

    – UjinT34
    Nov 22 '18 at 7: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











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413009%2flast-in-tmpl-if-not-always-works-in-perl-htmltemplate%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









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>






share|improve this answer
























  • 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 6:58













  • loop_context_vars is set to false by default

    – UjinT34
    Nov 22 '18 at 7: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
















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>






share|improve this answer
























  • 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 6:58













  • loop_context_vars is set to false by default

    – UjinT34
    Nov 22 '18 at 7: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














0












0








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>






share|improve this answer













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>







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '18 at 14:30









UjinT34UjinT34

1,766112




1,766112













  • 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 6:58













  • loop_context_vars is set to false by default

    – UjinT34
    Nov 22 '18 at 7: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



















  • 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 6:58













  • loop_context_vars is set to false by default

    – UjinT34
    Nov 22 '18 at 7: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

















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 6:58







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 6:58















loop_context_vars is set to false by default

– UjinT34
Nov 22 '18 at 7:21





loop_context_vars is set to false by default

– UjinT34
Nov 22 '18 at 7: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





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




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413009%2flast-in-tmpl-if-not-always-works-in-perl-htmltemplate%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)