2012-12-11 146 views
0

我粘貼低於輸出(最初發布到http://pastebin.com/Sh7a8tHK安裝Perl開關使用CPAN失敗

cpan[1]> install Switch 
Reading '/.cpan/Metadata' 
Database was generated on Tue, 11 Dec 2012 05:55:05 GMT 
Running install for module 'Switch' 
Running make for R/RG/RGARCIA/Switch-2.16.tar.gz 
Checksum for /.cpan/sources/authors/id/R/RG/RGARCIA/Switch-2.16.tar.gz ok 
Scanning cache /.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/ccs/bin/make -- OK 
Running make test 
PERL_DL_NONLAZY=1 /opt/perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t 
t/given.t ... Useless use of numeric gt (>) in void context at t/given.t line 19. 
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, 1 wallclock secs (0.07 usr 0.01 sys + 0.47 cusr 0.00 csys = 0.55 CPU) 
Result: FAIL 
Failed 1/3 test programs. 2/590 subtests failed. 
*** Error code 255 
make: Fatal error: Command failed for target `test_dynamic' 
RGARCIA/Switch-2.16.tar.gz 
/usr/ccs/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 

cpan[2]> 

似乎存在與所述模塊的一個問題是「無用的使用數字GT的證明.... 。「,但是我使用CPAN在另一臺機器上安裝了這個模塊。這是CPAN在安裝時唯一抱怨的模塊。

我使用的是最新版本的Perl 5.16:

This is perl 5, version 16, subversion 2 (v5.16.2) built for i86pc-solaris 

如何安裝這個模塊?

注意:請不要告訴我切換已棄用。我明白那個。

+1

請不要使用引擎收錄。如果文本處於pastebin,那麼未來的用戶將根據您報告的錯誤找不到此問題。 –

回答

2

試着這樣做:

use feature qw/switch/; 

perldoc -q switch 
+0

由於開關(給出\什麼時候)現在內置爲什麼我必須使用功能qw /開關/;?無論哪種方式,它的工作。謝謝。 – user974896

+3

爲了向後兼容。如果它始終打開,它會使用名爲'given'和'when'的子工具打破現有的程序。 – ikegami

+0

'使用5.010'自動啓用'given' /'when',也。 – creaktive

1

參考的有效Perler文章Use for() instead of given()如果你確定使用Perl V5.10或更高版本。

+1

5.018 ['given'](http://perldoc.perl.org/perlsyn.html#Switch-Statements)將會像['for'](http://perldoc.perl.org/perlsyn.html# Foreach-Loops)目前確實如此。 –

0

補丁:

--- Switch-2.16-wjgfvU/Switch.pm 2009-10-23 00:52:51.000000000 -0700

+++ Switch-2.16-wjgfvUcopy/Switch.pm 2010-08-15 17:41:38.000000000 -0700

@@ -146,7 +146,7 @@ sub filter_blocks 
die "Bad $keyword statement (problem in the code block?) near $Switch::file line ", line(substr($source,0, pos $source), $line), "\n"; 
     }; 
my $code = filter_blocks(substr($source,$pos[0],$pos[4]-$pos[0]),line(substr($source,0,$pos[0]),$line)); 
-   $code =~ s/{/{ local \$::_S_W_I_T_C_H; Switch::switch $arg;/; 
+   $code =~ s/{/{ local \$::_S_W_I_T_C_H; Switch::switch($arg);/; 
      $text .= $code . 'continue {last}'; 
      next component; 
     }