0

im newbie and learn Perl programming. Im confused about cpan, i know there is thousand library for support perl, but, how to install library from cpan ? im using cpan in linux, when i try to install switch, i have error message

cpan[1]> install Switch

and error when installing:

Reading '/root/.cpan/Metadata'
Database was generated on Mon, 13 Jan 2014 08:29:02 GMT
Running install for module 'Switch'
Running make for R/RG/RGARCIA/Switch-2.16.tar.gz
Checksum for /root/.cpan/sources/authors/id/R/RG/RGARCIA/Switch-2.16.tar.gz ok
Scanning cache /root/.cpan/build for sizes
............................................................................DONE

  CPAN.pm: Building R/RG/RGARCIA/Switch-2.16.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Switch
Writing MYMETA.yml and MYMETA.json
cp Switch.pm blib/lib/Switch.pm
Manifying blib/man3/Switch.3
  RGARCIA/Switch-2.16.tar.gz
  /usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.18.1 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/given.t ... Failed 2/293 subtests 
t/nested.t .. ok   
t/switch.t .. ok       

Test Summary Report
-------------------
t/given.t (Wstat: 0 Tests: 293 Failed: 2)
  Failed tests:  2-3
Files=3, Tests=590,  4 wallclock secs ( 0.31 usr  0.01 sys +  2.38 cusr  0.03 csys =  2.73 CPU)
Result: FAIL
Failed 1/3 test programs. 2/590 subtests failed.
make: *** [test_dynamic] Error 255
  RGARCIA/Switch-2.16.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports RGARCIA/Switch-2.16.tar.gz
Running make install
  make test had returned bad status, won't install without force
Failed during this command:
 RGARCIA/Switch-2.16.tar.gz                   : make_test NO

how to install switch ? thanks

  • 1
    Two subtests failed. Anyway, `Switch`, as a source filter, is not recommended. If you can avoid it, use `Switch::Plain`. `use feature 'switch'` was marked experimental in 5.18. – choroba Jan 13 '14 at 13:21

1 Answers1

4

You are doing everything right, but Switch is broken on Perl 5.13.3 and above. The maintainers of the modules know about the issue, and are seemingly uninterested in fixing it. Given the poor maintenance of the module, even if you did persuade it to install, it wouldn't seem advisable to use it in production code.

A couple of recent relevant discussions on PerlMonks discussing switch-like constructs:

tobyink
  • 13,478
  • 1
  • 23
  • 35
  • Not "seemingly", but decidedly and purposely not spending time on a module that was replaced with a core feature. :) – brian d foy Jan 13 '14 at 13:39
  • @brian d foy, said core feature is experimental and likely to change. – ikegami Jan 13 '14 at 13:41
  • @tobyink, A far better reason not to use the module is that it was written as a proof of concept and never intended for production use! – ikegami Jan 13 '14 at 13:42
  • @ikegami that core feature is _now_ experimental and will change. It wasn't experimental when they decided to abandon Switch, will no one ever liked aside from its celebrity endorsement. – brian d foy Jan 13 '14 at 13:44
  • @brian d foy, If you're referring to the author, he's the source of my last comment. – ikegami Jan 13 '14 at 13:56