Missing switch.pm - Active Perl x64/windows
Asked Answered
C

3

5

I have installed Active Perl (v5.14.2, 64-bit, for Windows) and my code containing use Switch; started to fail with the error Can't locate Switch.pm in @INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib .) at myfilename.pl line 3..

Copying switch.pm over from an older 32-bit installation fixed the problem, but I don't understand it. Has switch.pm been deprecated in the meantime?

Clamper answered 28/4, 2012 at 3:17 Comment(1)
possible duplicate of Why is the Switch module deprecated in Perl?Hebdomadal
B
18

It was replaced with given/when:

Starting from Perl 5.10, you can say

use feature "switch";

which enables a switch feature that is closely based on the Perl 6 proposal.

See also Deprecations in perl5101delta:

The following items are now deprecated.

Switch is buggy and should be avoided. From perl 5.11.0 onwards, it is intended that any use of the core version of this module will emit a warning, and that the module will eventually be removed from the core (probably in perl 5.14.0).

If you have legacy code that uses Switch.pm, it's still available on CPAN.

Bedroom answered 28/4, 2012 at 3:51 Comment(0)
E
6

You can install the "Switch" package on a windows system at the command prompt with the command: ppm install Switch

Episcopalism answered 14/8, 2014 at 13:9 Comment(1)
Thanks and it works for ActivePerl 5.20.2.200 for windows x86 for me.Alvis
E
0

you need to install "Strawberry Perl" it is aperl version + cpan module ;)

Expository answered 2/11, 2013 at 8:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.