新发布的Mavericks已从其存储库中删除了已弃用的模块“Switch.pm”。 但是,我最近尝试构建AOSP源代码树,它以某种方式使用此模块生成“make-hash-tools.pl”
The Mavericks的perl版本为5.16.2,其前身Mountain Lion的版本为5.12.4。有没有办法降级我的Perl?
编译错误如下所示:
Can't locate Switch.pm in @INC (@INC contains: /Library/Perl/5.16/darwin-thread-\
multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level\
/Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2\
/System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16\
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level \
/System/Library/Perl/Extras/5.16 .) at external/webkit/Source/WebCore\
/make-hash-tools.pl line 23.
感谢〜!
答案 0 :(得分:5)
您可以使用perlbrew在其自己的目录中使用自己的模块安装并行版本的Perl。目前,它允许您安装Perl,早在5.003_07,但Perl Porters并不是所有这些都支持安全修复。
install Switch from CPAN可能更简单。
答案 1 :(得分:3)
看起来像'$ sudo cpanm Switch --force'为我工作
答案 2 :(得分:2)
你也可以用这个:
$ sudo defaults write '/Library/Preferences/com.apple.versioner.perl' Version 5.12
对于大多数东西,它使perl运行版本12。不幸的是,不适用于apache
...
答案 3 :(得分:1)
在10.9.2上为我工作,没有" force"。
cpan[2]> install Switch
Running install for module 'Switch'
Running make for C/CH/CHORNY/Switch-2.17.tar.gz
Fetching with LWP:
...一堆取物......
CPAN.pm: Building C/CH/CHORNY/Switch-2.17.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for Switch
Writing MYMETA.yml and MYMETA.json
......一堆xcode许可证......
cp Switch.pm blib/lib/Switch.pm
Manifying blib/man3/Switch.3pm
CHORNY/Switch-2.17.tar.gz
/usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/given.t ... ok
t/nested.t .. ok
t/switch.t .. ok
All tests successful.
Files=3, Tests=590, 0 wallclock secs ( 0.04 usr 0.01 sys + 0.22 cusr 0.01 csys = 0.28 CPU)
Result: PASS
CHORNY/Switch-2.17.tar.gz
/usr/bin/make test -- OK
Running make install
Installing /Library/Perl/5.16/Switch.pm
Installing /usr/local/share/man/man3/Switch.3pm
Appending installation info to /Library/Perl/Updates/5.16.2/darwin-thread-multi-2level/perllocal.pod
CHORNY/Switch-2.17.tar.gz
/usr/bin/make install -- OK
然后我运行了我的代码,之前已经调整了"无法在@ INC"中定位Switch.pm。错误,代码运行正常。
答案 4 :(得分:0)
我发现这些命令有效。
sudo perl -MCPAN -e shell
cpan>强制安装Switch
答案 5 :(得分:0)