<!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 16199 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is : <br><br>Title : Koha-devel Digest, Vol 189, Issue 16<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. Koha Community Newsletter: August 2021 (Koha Newsletter)<br>   2. Perl advice for checking hash content (Victor Grousset/tuxayo)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Fri, 27 Aug 2021 17:59:37 +0200<br>From: Koha Newsletter <kohanews@gmail.com><br>To: koha <koha@lists.katipo.co.nz>,  koha-devel<br>    <koha-devel@lists.koha-community.org><br>Subject: [Koha-devel] Koha Community Newsletter: August 2021<br>Message-ID:<br>    <CAEqgz_=1b0-PSQp2oypKZvPhYs1mQPHju93OBHaOfnYmRbcyzw@mail.gmail.com><br>Content-Type: text/plain; charset="utf-8"<br><br>The Koha Community Newsletter for August 2021 is here:<br><br>* https://koha-community.org/koha-community-newsletter-august-2021/<br><br>Many thanks to everyone who submitted articles and news this newsletter!<br><br>Please feel free to email me with any corrections or suggestions.<br>--<br>Michael Kuhn<br>Editor, Koha Community Newsletter<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210827/1ff47f9f/attachment-0001.htm><br><br>------------------------------<br><br>Message: 2<br>Date: Sat, 28 Aug 2021 09:38:04 +0200<br>From: Victor Grousset/tuxayo <victor@tuxayo.net><br>To: koha-devel <koha-devel@lists.koha-community.org><br>Subject: [Koha-devel] Perl advice for checking hash content<br>Message-ID: <4aeca8ca-6b49-d8a6-35ee-8829e68d41b2@tuxayo.net><br>Content-Type: text/plain; charset=utf-8; format=flowed<br><br>Hi :)<br><br>For a development, I'm adding additional keys to <br>C4::Reserves::CanItemBeReserved returned hash.<br><br>But there are a bunch of tests that match the whole return value and <br>thus don't expect the new keys in the hash.<br><br>Here is the best way so far I've found to adapt it.<br><br><br>is_deeply(<br>     CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),<br>     { status => 'tooManyReservesToday', limit => 0 },<br>     'Patron cannot reserve if holds_per_day is 0 (i.e. 0 is 0)'<br>);<br><br>↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓<br><br>my @status_and_limit = @{CanItemBeReserved( $patron->borrowernumber, <br>$itemnumber_2 )}{"status", "limit"};<br>is_deeply(<br>     \@status_and_limit,<br>     ['tooManyReservesToday', 0],<br>     'Patron cannot reserve if holds_per_day is 0 (i.e. 0 is 0)'<br>);<br><br><br>How could this be better?<br>Since it took me more than two hours only to have something that works <br>and without warnings. There are surely other ways to do it™, and <br>hopefully a nicer one.<br>Most of the time was reading and learning by trial and error about <br>referencing and dereferencing and the specifics or Perl hashes and <br>array. It's odd to have been working 3.5 years on Koha closer to the <br>code than to the librarian stuff and only have to really start learning <br>Perl now ^^<br>Away, this is why advice is needed to have something that fit the good <br>practices :)<br><br>Key/Value Hash Slices would allow to not change the expected param of <br>is_deeply() but that doesn't really look different for the readability.<br>And isn't worth having Koha bump minimal Perl version from 5.14 (2011) <br>to 5.20 (2014). Ok it's just for running the tests and not production <br>but still. -> very minor or inexistent readability improvement.<br>https://perldoc.perl.org/perldata#Key/Value-Hash-Slices<br><br>Having two assertions (is() calls) for status and limit would allow a <br>simpler syntax but add duplication.<br><br><br>Cheers,<br><br>-- <br>Victor Grousset/tuxayo<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 189, Issue 16<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>