A new request with request id 17803 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is :

Title : Koha-devel Digest, Vol 187, Issue 11
Category :
Description :
Send Koha-devel mailing list submissions to
    koha-devel@lists.koha-community.org

To subscribe or unsubscribe via the World Wide Web, visit
    https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
or, via email, send a message with subject or body 'help' to
    koha-devel-request@lists.koha-community.org

You can reach the person managing the list at
    koha-devel-owner@lists.koha-community.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Koha-devel digest..."


Today's Topics:

1. Re: Perl syntax for strings (Thomas Klausner)
2. Re: some thoughts on #28519 regarding lib (Jonathan Druart)


----------------------------------------------------------------------

Message: 1
Date: Tue, 15 Jun 2021 11:00:38 +0200
From: Thomas Klausner <domm@plix.at>
To: koha-devel@lists.koha-community.org
Subject: Re: [Koha-devel] Perl syntax for strings
Message-ID: <YMhsNoJn6AUMfTsP@plix.at>
Content-Type: text/plain; charset=us-ascii

Hi!

On Tue, Jun 15, 2021 at 10:19:12AM +0200, Fridolin SOMERS wrote:

> I see in Perl code some cases where a string in written with a space between
> q or qq or qw and string.
> Like : qq /foo bar/ instead of qq/foo bar/

While this works, it is strongly recommended to not use this "feature".
It's main "use" is to use ANY string as quote-like operator:

perl -E 'say qq A({/";A'
({/";

But of course this is horrible and should not be used (outside of
obfuscations..)

> Most of cases are in :
> use CGI qw ( -utf8 );

This isn't even using the "feature" to allow any string..

> There are only 29 other cases :
> git grep -E ' q[qw]? [/({]' | grep -v 'use CGI qw '

Of course this regex would fail to find why the space after q/qq/qw is
allowed, because using the space you can use ANY char for the quote-like
op. But I'm quite sure that nobody is crazy enough to put that into
production code. And coming up with a regex that matches this would be
quite hard... Though maybe there is a Perl::Critic rule for it?

> Should we add a coding guideline ?
> https://wiki.koha-community.org/wiki/Coding_Guidelines

++

Greetings,
domm

--
#!/usr/bin/perl https://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}


------------------------------

Message: 2
Date: Tue, 15 Jun 2021 11:26:18 +0200
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
To: koha-devel <koha-devel@lists.koha-community.org>
Subject: Re: [Koha-devel] some thoughts on #28519 regarding lib
Message-ID:
    <CAJzKNY5LN74QHOB3cXM-q8HTa=4QDU3pBG1dck6vNwS9HC2j6A@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hi Thomas,

I've sent the following notes to the QA team, but maybe it needed to be public.
The history behind 28519 is not trivial :)

"""
To clarify and explain a bit more what we are doing here (to those
outside of the loop):
- We switched from YAML[::Syck] to YAML::XS (22824, 27673)
- We had to replace the YAML serializer provided by CGI::Session (no
YAML::XS serializer exists in cpan).
- We decided to switch back to the default serializer (using
Data::Dumper), which we used a looong time ago in Koha already, but
faced... encoding problems. However we couldn't replicate them and
thought we were safe (28317).
- 21.05.00 is released and we discover a bug (28489), there is an
encoding issue caused by Data::Dumper (and more precisely its C
implementation, see bug 28489 comment 13 for more info). To add to the
confusion: the bug appears only if strict_sql_modes is on.
- We need a fix for 21.05.01!
- There are several options we investigate on Friday, lot seems to be
working but few really work:
* $Data::Dumper::Useperl=1 (maybe)
* Reintroduce YAML::Syck and get back to CGI::Session::Serializer::YAML
* Use our own YAML::XS serializer (which has been suggested when we
moved to Data::Dumper already)
We decided to go with the latter and Andrew wrote a patch. A bit hacky
as the Serializer::yamlxs code was inside C4::Auth. David wrote a
follow-up (28519) to clean it and move the code to a separate file.

What's next?
- We need 28489 for 21.05.01
- Ideally we need 28519 as well!
- We should move to Data::Session and decide on the JSON serializer or
write our YAML::XS serializer for Data::Session (17427)
"""

We actually need CGI::Session::Serializer::yamlxs, not CGI::Session
(we are still installing it from the debian package).

Hope that clarifies
Cheers,
Jonathan

Le mar. 15 juin 2021 à 10:48, Thomas Klausner <domm@plix.at> a écrit :
>
> Hi!
>
> without knowing a lot of Koha-internals (still..), I'd strongly prefer
> to have all the code in a lib dir (as is standard in Perl apps / modules
> for ages).
>
> There are also a lot of tools available to make using code stored `lib`
> (but not "installed" in the system, i.e. only available in the checkout)
> easy. The simplest is of course 'lib': https://perldoc.perl.org/lib
>
> Or more complex like https://metacpan.org/pod/lib::projectroot (which I
> wrote some time ago to handle a Monorepo setup; it also includes a
> comparison of different modules in the SEE ALSO section)
>
> OTOH, CGI::Session::Serialize is a cpan module, so technically it should
> not be checked out into the app code `lib`, but installed as a
> dependency. There are even more ways to handle installing of
> dependencies and the finding them, but the currently most comfortable
> one is https://metacpan.org/pod/Carton. Or (if running everything via
> Carton is too much of a change), a combination of
> https://metacpan.org/pod/local::lib and a modern CPAN client
> (https://metacpan.org/pod/App::cpanminus or
> https://metacpan.org/pod/App::cpm.
>
> I did not want to spam the actuall ticket with this, as I'm not sure if
> any of this is in fact relevant to the bug, and/or matches the current
> plans for Koha.
>
> Greetings,
> domm
>
>
> --
> #!/usr/bin/perl https://domm.plix.at
> for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/


------------------------------

Subject: Digest Footer

_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/


------------------------------

End of Koha-devel Digest, Vol 187, Issue 11
*******************************************


NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.