【问题标题】:Private perlbrew and CPAN not working. Still. Again私有 perlbrew 和 CPAN 不工作。仍然。再次
【发布时间】:2012-10-04 09:51:34
【问题描述】:

我以为我已经成功了。

我有一个完全私有的 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???

【问题讨论】:

    标签: perl cpan perlbrew


    【解决方案1】:

    如果您跳过或搞砸了第 6 步(为每个 perl 设置“cpanm”),那么您可能正在运行一个以前随系统 perl 安装的 cpanm,因此它想要写入系统目录。

    最新版本的 perlbrew 有一个“install-cpanm”命令,可以将 cpanm 安装在任何 perl 之外的特殊位置。这样,您就不必为您酿造的每个 perl 安装 cpanm。这可能是您需要的。

    【讨论】:

      【解决方案2】:

      我建议你查看 cpanm 可执行文件的源代码。

      您的cpanm 命令有可能包含#!/usr/bin/perl 的shebang。在这种情况下,perlbrew switchperlbrew use 无法更改 perl 的版本来调用 cpanm 命令。 (当然,除非你一直像perl /usr/bin/cpanm 一样运行它。

      如果您通过curl -o cpanm http://cpanmin.usperlbrew install-cpanm 进行安装,它应该包含一个显示/usr/bin/env perl 的shebang,可以动态切换。

      【讨论】:

        猜你喜欢
        • 2016-04-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-08-09
        • 2011-08-02
        • 1970-01-01
        • 2012-08-27
        • 1970-01-01
        相关资源
        最近更新 更多