Bug 11468

Summary: Remove use of smartmatch from DateUtils
Product: Koha Reporter: Colin Campbell <colin.campbell>
Component: Architecture, internals, and plumbingAssignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 11148    
Attachments: Proposed Patch
Bug 11468 Remove given when from Koha::Dateutils
[PASSED QA] Bug 11468 Remove given when from Koha::Dateutils

Description Colin Campbell 2014-01-02 14:40:51 UTC
As the given/when keywords now generate errors in current perl and their future behaviour is subject to change. Remove them from Dateutils which generates errors in all code using it
Comment 1 Colin Campbell 2014-01-02 14:56:30 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2014-01-05 06:47:17 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2014-01-05 22:55:56 UTC
Created attachment 23914 [details] [review]
[PASSED QA] Bug 11468 Remove given when from Koha::Dateutils

given and when give warnings due to their experimental
status as of perl 5.18. Replace the construct with
an if/elsif to avoid the keywords

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, especially t/DateUtils.t.
Comment 4 Galen Charlton 2014-01-06 05:50:18 UTC
Pushed to master.  Thanks, Colin!
Comment 5 Fridolin Somers 2014-02-18 08:05:51 UTC
Should the use of given/when be avoided ?
If yes it may be added to http://wiki.koha-community.org/wiki/Coding_Guidelines
Comment 6 Colin Campbell 2014-02-20 14:05:55 UTC
(In reply to Fridolin SOMERS from comment #5)
> Should the use of given/when be avoided ?
> If yes it may be added to
> http://wiki.koha-community.org/wiki/Coding_Guidelines

I think so This is the perldelta for 5.18 :

 The smartmatch family of features are now experimental
    Smart match, added in v5.10.0 and significantly revised in v5.10.1, has
    been a regular point of complaint. Although there are a number of ways in
    which it is useful, it has also proven problematic and confusing for both
    users and implementors of Perl. There have been a number of proposals on
    how to best address the problem. It is clear that smartmatch is almost
    certainly either going to change or go away in the future. Relying on its
    current behavior is not recommended.

    Warnings will now be issued when the parser sees "~~", "given", or "when".
    To disable these warnings, you can add this line to the appropriate scope:

      no if $] >= 5.018, warnings => "experimental::smartmatch";

    Consider, though, replacing the use of these features, as they may change
    behavior again before becoming stable.
Comment 7 Fridolin Somers 2014-08-06 10:44:51 UTC
Pushed to 3.14.x, will be in 3.14.10
Comment 8 Kyle M Hall 2014-08-13 14:40:32 UTC
Picked for 3.12.15!