<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>A new request with request id 18479 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is : <br><br>Title : Koha-devel Digest, Vol 186, Issue 9<br>Category : <br>Description : <div>Send Koha-devel mailing list submissions to<br>    koha-devel@lists.koha-community.org<br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>    https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>or, via email, send a message with subject or body 'help' to<br>    koha-devel-request@lists.koha-community.org<br><br>You can reach the person managing the list at<br>    koha-devel-owner@lists.koha-community.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Koha-devel digest..."<br><br><br>Today's Topics:<br><br>   1. Re: TT loop count VS size (Fridolin SOMERS)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Mon, 10 May 2021 10:02:02 +0200<br>From: Fridolin SOMERS <fridolin.somers@biblibre.com><br>To: dcook@prosentient.com.au, 'Tomas Cohen Arazi'<br>    <tomascohen@gmail.com><br>Cc: 'Jonathan Druart' <jonathan.druart@bugs.koha-community.org>,<br>    'koha-devel' <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] TT loop count VS size<br>Message-ID: <401f353d-e741-ad2e-3f26-15a17f6fa2cb@biblibre.com><br>Content-Type: text/plain; charset=utf-8; format=flowed<br><br>Ahhh my bad.<br><br>So VAR.size is when VAR is an array.<br>VAR.count is allow when VAR is a Koha::Objects, in perl called with ->count.<br><br>Forget my warning ;)<br><br>Best regards,<br><br><br>Le 10/05/2021 à 04:20, dcook@prosentient.com.au a écrit :<br>> I know that .count is an object method, but I don’t understand the <br>> problem that Fridolin is having. I don’t see any problem at this point.<br>> <br>> David Cook<br>> <br>> Software Engineer<br>> <br>> Prosentient Systems<br>> <br>> Suite 7.03<br>> <br>> 6a Glen St<br>> <br>> Milsons Point NSW 2061<br>> <br>> Australia<br>> <br>> Office: 02 9212 0899<br>> <br>> Online: 02 8005 0595<br>> <br>> *From:*Tomas Cohen Arazi <tomascohen@gmail.com><br>> *Sent:* Monday, 10 May 2021 11:14 AM<br>> *To:* David Cook <dcook@prosentient.com.au><br>> *Cc:* Jonathan Druart <jonathan.druart@bugs.koha-community.org>; <br>> Fridolin SOMERS <fridolin.somers@biblibre.com>; koha-devel <br>> <koha-devel@lists.koha-community.org><br>> *Subject:* Re: [Koha-devel] TT loop count VS size<br>> <br>> That's because .count is a Koha::Objects method.<br>> <br>> El dom., 9 may. 2021 20:50, <dcook@prosentient.com.au <br>> <mailto:dcook@prosentient.com.au>> escribió:<br>> <br>>     I was going to say… I’d never even heard of the “count” call in TT.<br>>     Looking at http://template-toolkit.org/docs/manual/VMethods.html<br>>     <http://template-toolkit.org/docs/manual/VMethods.html>, it’s not a<br>>     method for a data structure. Looking at<br>>     http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH<br>>     <http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH>,<br>>     it’s only a method of the “loop” variable.<br>> <br>>     grep -R "loop\.count" *   | wc -l<br>> <br>>     86<br>> <br>>     What’s the actual problem being observed?<br>> <br>>     David Cook<br>> <br>>     Software Engineer<br>> <br>>     Prosentient Systems<br>> <br>>     Suite 7.03<br>> <br>>     6a Glen St<br>> <br>>     Milsons Point NSW 2061<br>> <br>>     Australia<br>> <br>>     Office: 02 9212 0899<br>> <br>>     Online: 02 8005 0595<br>> <br>>     *From:*Koha-devel <koha-devel-bounces@lists.koha-community.org<br>>     <mailto:koha-devel-bounces@lists.koha-community.org>> *On Behalf Of<br>>     *Jonathan Druart<br>>     *Sent:* Friday, 7 May 2021 5:58 PM<br>>     *To:* Fridolin SOMERS <fridolin.somers@biblibre.com<br>>     <mailto:fridolin.somers@biblibre.com>><br>>     *Cc:* koha-devel <koha-devel@lists.koha-community.org<br>>     <mailto:koha-devel@lists.koha-community.org>><br>>     *Subject:* Re: [Koha-devel] TT loop count VS size<br>> <br>>     You should grep "loop.count", not ".count"<br>> <br>>     Most of the count you have with your regex is coming from<br>>     koha_objects->count<br>> <br>>     Le ven. 7 mai 2021 à 09:17, Fridolin SOMERS<br>>     <fridolin.somers@biblibre.com <mailto:fridolin.somers@biblibre.com>><br>>     a écrit :<br>> <br>>         Hi community,<br>> <br>>         I've been on a mindblowing search on a template error :D<br>> <br>>         I was thinking that "loop.count" was wrong for testing if loop<br>>         is not<br>>         empty, the method is "loop.size".<br>> <br>>         See doc<br>>         http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH<br>>         <http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH><br>> <br>>         Looks like we use both actually :<br>>            > git grep 'IF.*\.count ' origin/master | wc -l<br>>         602<br>>            > git grep 'IF.*\.size ' origin/master | wc -l<br>>         1636<br>> <br>>         So using count seems to work because it starts with 1.<br>>         But in my opinion it is a wrong call.<br>> <br>>         We can see for example :<br>>            <a href="#images">Images ([% localimages.count || 0 | html<br>>         %])</a><br>>         This is wrong no ?<br>> <br>>         Should be create a coding guideline ?<br>> <br>>         -- <br>>         Fridolin SOMERS <fridolin.somers@biblibre.com<br>>         <mailto:fridolin.somers@biblibre.com>><br>>         Software and system maintainer 🦄<br>>         BibLibre, France<br>>         _______________________________________________<br>>         Koha-devel mailing list<br>>         Koha-devel@lists.koha-community.org<br>>         <mailto:Koha-devel@lists.koha-community.org><br>>         https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>>         <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel><br>>         website : https://www.koha-community.org/<br>>         <https://www.koha-community.org/><br>>         git : https://git.koha-community.org/<br>>         <https://git.koha-community.org/><br>>         bugs : https://bugs.koha-community.org/<br>>         <https://bugs.koha-community.org/><br>> <br>>     _______________________________________________<br>>     Koha-devel mailing list<br>>     Koha-devel@lists.koha-community.org<br>>     <mailto:Koha-devel@lists.koha-community.org><br>>     https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>>     <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel><br>>     website : https://www.koha-community.org/<br>>     <https://www.koha-community.org/><br>>     git : https://git.koha-community.org/ <https://git.koha-community.org/><br>>     bugs : https://bugs.koha-community.org/<br>>     <https://bugs.koha-community.org/><br>> <br><br>-- <br>Fridolin SOMERS <fridolin.somers@biblibre.com><br>Software and system maintainer 🦄<br>BibLibre, France<br><br><br>------------------------------<br><br>Subject: Digest Footer<br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br><br>------------------------------<br><br>End of Koha-devel Digest, Vol 186, Issue 9<br>******************************************<br></div><br><br>NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.<br></body></html>