【问题标题】:cpan install switch failedcpan 安装开关失败
【发布时间】:2014-02-01 05:17:23
【问题描述】:

我是新手,学习 Perl 编程。我对 cpan 感到困惑,我知道有上千个库支持 perl,但是,如何从 cpan 安装库?我在linux中使用cpan,当我尝试安装switch时,我有错误消息

cpan[1]> install Switch

安装时出错:

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

如何安装开关? 谢谢

【问题讨论】:

  • 两个子测试失败。无论如何,不​​推荐Switch作为源过滤器。如果可以避免,请使用Switch::Plainuse feature 'switch' 在 5.18 中被标记为实验性的。

标签: linux perl cpan


【解决方案1】:

您做的一切都是正确的,但 Switch 是 broken on Perl 5.13.3 and above。模块的维护者知道这个问题,并且似乎对修复它不感兴趣。鉴于模块维护不善,即使您确实说服它安装,也不建议在生产代码中使用它。

最近一些关于 PerlMonks 的相关讨论讨论了类似开关的构造:

【讨论】:

  • 不是“表面上”,而是明确而有目的地不花时间在一个被核心功能取代的模块上。 :)
  • @brian d foy,说核心功能是实验性的,可能会改变。
  • @tobyink,不使用该模块的一个更好的理由是它是作为概念证明编写的,从未用于生产用途!
  • @ikegami 核心功能现在是实验性的,将会改变。当他们决定放弃 Switch 时,这并不是实验性的,除了名人代言之外,没有人会喜欢它。
  • @brian d foy,如果你指的是作者,他是我最后评论的来源。
猜你喜欢
  • 2013-11-07
  • 2018-06-19
  • 2013-11-04
  • 1970-01-01
  • 2012-05-04
  • 2012-09-28
  • 2019-03-01
  • 1970-01-01
  • 2015-09-16
相关资源
最近更新 更多