Bug 5105

Summary: Switch Module Depreciated in perl 12
Product: Koha Reporter: Colin Campbell <colin.campbell>
Component: Architecture, internals, and plumbingAssignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: enhancement    
Priority: PATCH-Sent (DO NOT USE) CC: chris, f.demians, ztajoli
Version: rel_3_2   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Proposed Patch

Description Colin Campbell 2010-08-09 08:21:00 UTC
Use of the Switch module is depreciated in perl 12 and above and generates warnings to that effect. Occurrences in the source should be replaced.

As 3.2 is compatible with perl 5.8.8 Switch would have to be replaced by an if/else construct. In future version of Koha (i.e. supporting 5.10 and greater only) the given/when syntax is available.
Comment 1 Zeno Tajoli 2010-08-09 13:12:30 UTC
But where can I see those warnings ?
Only in logs, I think.
So the work path that I suggest is:
3.0.x -> no changes
3.2 -> delete Switch, use ifs
3.4 -> start to use 'given' and 'when', insert perl 5.10 as a requirement.

Where I find use Switch:

$ grep -r 'use Switch' *

basket/downloadcart.pl:use Switch;
C4/Reports/Guided.pm:use Switch;
opac/opac-downloadcart.pl:use Switch;
opac/opac-detail.pl:use Switch;
opac/opac-downloadshelf.pl:use Switch;
tools/batchMod.pl:use Switch;
virtualshelves/downloadshelf.pl:use Switch;
Comment 2 Colin Campbell 2010-09-08 13:09:05 UTC
Created attachment 2604 [details] [review]
Proposed Patch
Comment 3 Chris Cormack 2010-11-10 22:34:24 UTC
Pushed to new/bug_5105

And merged to master, please test and close
Comment 4 Frédéric Demians 2010-11-11 08:16:38 UTC
Added a regression test:

http://lists.koha-community.org/pipermail/koha-patches/2010-November/012895.html
Comment 5 Chris Cormack 2010-11-12 02:46:17 UTC
Regression test pushed also