2012-10-14 51 views
0

我以爲我有它的工作。私人perlbrew和CPAN無法正常工作。仍然。

我有一個完全私有版本的Perl 5.16(私有我的意思是本地到我的主目錄),併爲CPAN模塊的私人場所。我遵循http://blog.fox.geek.nz/2010/09/installing-multiple-perls-with.html(針對其輕微的過期問題進行了調整)的指示,聲稱完全避開了對local :: lib的需要。我使用了上述instrux安裝的cpanm來安裝Cache :: Memcached :: Fast.pm,併成功運行了一個使用此模塊的Perl程序。

今天它不工作。

Can't locate Cache/Memcached/Fast.pm in @INC (@INC contains:  
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/darwin-2level 
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16. 
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/darwin-2level 
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1 .) at ./memget line 11. 

一些故障排除:

/Users/chap$ perlbrew use 
Currently using perl-5.16.1 

...甜蜜。

/Users/chap$ which perl 
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/bin/perl 

...太棒了。

/Users/chap$ perlbrew switch perl-5.16.1 
/Users/chap$ cpanm --interactive -v App::cpanoutdated 
cpanm (App::cpanminus) 1.5014 on perl 5.012004 built for darwin-thread-multi-2level 
Work directory is /Users/chap/.cpanm/work/1350175791.76873 
You have make /usr/bin/make 
You have LWP 6.03 
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3 
You have /usr/bin/unzip 
Searching App::cpanoutdated on cpanmetadb ... 
! 
! Can't write to /Library/Perl/5.12 and /usr/local/bin: Installing modules to /Users/chap/perl5 
! To turn off this warning, you have to do one of the following: 
! - run me as a root or with --sudo option (to install to /Library/Perl/5.12 and /usr/local/bin) 
! - Configure local::lib your existing local::lib in this shell to set PERL_MM_OPT etc. 
! - Install local::lib by running the following commands 
! 
!   cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) 
! 
Checking if you have ExtUtils::MakeMaker 6.31 ... Yes (6.62) 
Checking if you have ExtUtils::Install 1.46 ... Yes (1.55) 
App::cpanoutdated is up to date. (0.23) 

呃哦。爲什麼系統Perl?

回答

1

如果您跳過或滑過步驟6(爲每個perl設置'cpanm'),那麼您可能正在運行一個以前與系統perl一起安裝的cpanm,因此它想要寫入系統目錄。

最近的perlbrew版本有一個'install-cpanm'命令,它將cpanm安裝在任何perl之外的特殊位置。這樣,您不必爲每個您釀造的perl安裝cpanm。這可能是你需要的。

1

我建議你檢查一下cpanm可執行文件的源代碼。

您的cpanm命令有可能包含的shebang。在這種情況下,perlbrew switchperlbrew use無法更改perl的版本以調用cpanm命令。 (當然,除非,你運行它像perl /usr/bin/cpanm所有的時間。

如果通過curl -o cpanm http://cpanmin.usperlbrew install-cpanm它應該包含一個家當,說/usr/bin/env perl,可動態切換完成安裝。

相關問題