Bug 11468 - Remove use of smartmatch from DateUtils
Summary: Remove use of smartmatch from DateUtils
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Colin Campbell
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 11148
  Show dependency treegraph
 
Reported: 2014-01-02 14:40 UTC by Colin Campbell
Modified: 2015-06-04 23:30 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed Patch (2.07 KB, patch)
2014-01-02 14:56 UTC, Colin Campbell
Details | Diff | Splinter Review
Bug 11468 Remove given when from Koha::Dateutils (2.13 KB, patch)
2014-01-05 06:47 UTC, Chris Cormack
Details | Diff | Splinter Review
[PASSED QA] Bug 11468 Remove given when from Koha::Dateutils (2.25 KB, patch)
2014-01-05 22:55 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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!