Bug 11479 - Remove experimental given/when from C4::MarcModificationTemplates
Summary: Remove experimental given/when from C4::MarcModificationTemplates
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:
 
Reported: 2014-01-06 12:05 UTC by Colin Campbell
Modified: 2014-12-07 20:05 UTC (History)
3 users (show)

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


Attachments
Proposed patch (4.58 KB, patch)
2014-01-06 12:15 UTC, Colin Campbell
Details | Diff | Splinter Review
Bug 11479 Remove experimental given/when keywords (4.63 KB, patch)
2014-02-18 06:02 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11479 Remove experimental given/when keywords (4.69 KB, patch)
2014-02-20 13:25 UTC, Jonathan Druart
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-06 12:05:55 UTC
Compile time warnings are issued by perl 5.18 and greater over use of experimental keywords given and when as behaviour may change in next release. 

Replace usage of these constructs with core syntax
Comment 1 Colin Campbell 2014-01-06 12:15:30 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2014-02-18 06:02:08 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2014-02-18 14:31:46 UTC
This one is not a given/when, but a for/when. Which is not experimental.
To me this patch is not relevant.
Comment 4 Colin Campbell 2014-02-20 12:42:04 UTC
(In reply to Jonathan Druart from comment #3)
> This one is not a given/when, but a for/when. Which is not experimental.
> To me this patch is not relevant.

~/kohaclone$ perl -wc C4/MarcModificationTemplates.pm 
when is experimental at /home/cc/kohaclone/Koha/SimpleMARC.pm line 93.
when is experimental at /home/cc/kohaclone/Koha/SimpleMARC.pm line 96.
when is experimental at /home/cc/kohaclone/Koha/SimpleMARC.pm line 99.
when is experimental at C4/MarcModificationTemplates.pm line 552.
when is experimental at C4/MarcModificationTemplates.pm line 558.
when is experimental at C4/MarcModificationTemplates.pm line 564.
when is experimental at C4/MarcModificationTemplates.pm line 570.
when is experimental at C4/MarcModificationTemplates.pm line 581.
when is experimental at C4/MarcModificationTemplates.pm line 584.
when is experimental at C4/MarcModificationTemplates.pm line 587.
when is experimental at C4/MarcModificationTemplates.pm line 590.
C4/MarcModificationTemplates.pm syntax OK


And here is the notification from the 5.18 delta

 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.

for/when relies on smartmatch the patch is relevant
Comment 5 Jonathan Druart 2014-02-20 13:25:34 UTC
Created attachment 25497 [details] [review]
Bug 11479 Remove experimental given/when keywords

Replace constructs using given and when by if/else
feature now generates compilation warnings in 5.18
and is liable to change behaviour

replaced the construcrs with if/else
reformatted the if branching using perltidy
to remove the now redundant indent

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 6 Galen Charlton 2014-02-20 15:57:54 UTC
Pushed to master.  Thanks, Colin!
Comment 7 Fridolin Somers 2014-05-21 07:36:11 UTC
Pushed to 3.14.x, will be in 3.14.07