【问题标题】:perlbrew perl cpanm faultyperlbrew perl cpanm 错误
【发布时间】:2017-04-16 09:33:07
【问题描述】:

我在 cpanm 下安装了一个模块,显然不正确。在系统 perl 下运行时可见且可用,但在 perlbrew 下不可用。但是,perlbrews cpanm 表明该模块已成功安装。最佳步骤?

/Users/john/perl5/perlbrew/perls/perl-5.18.2/bin/perl
/Users/john/perl5/bin/cpanm
#!/usr/bin/perl
MM: INSTALL_BASE=/Users/john/perl5
MB: --install_base "/Users/john/perl5"

Note: .pl file contains following
#!/usr/bin/env perl

perlbrew 切换后...

declare -x PERL5LIB="/Users/john/perl5/lib/perl5"
declare -x PERLBREW_BASHRC_VERSION="0.76"
declare -x PERLBREW_HOME="/Users/john/.perlbrew"
declare -x PERLBREW_MANPATH="/Users/john/perl5/perlbrew/perls/perl-5.18.2/man"
declare -x PERLBREW_PATH="/Users/john/perl5/perlbrew/bin:/Users/john/perl5/perlbrew/perls/perl-5.18.2/bin"
declare -x PERLBREW_PERL="perl-5.18.2"
declare -x PERLBREW_ROOT="/Users/john/perl5/perlbrew"
declare -x PERLBREW_VERSION="0.76"
declare -x PERL_LOCAL_LIB_ROOT="/Users/john/perl5"
declare -x PERL_MB_OPT="--install_base \"/Users/john/perl5\""
declare -x PERL_MM_OPT="INSTALL_BASE=/Users/john/perl5"

Link to sybase install with hombrew

【问题讨论】:

  • 请提供which perl ; which cpanm ; head -n 1 "$( which cpanm )" ; printf 'MM: %s\n' "$PERL_MM_OPT" ; printf 'MB: %s\n' "$PERL_MB_OPT"的输出
  • 在 perlbrew 中尝试以下操作。 $ cpanm --interactive -v App::cpanoutdated$ cpan-outdated$ cpanm --interactive -v App::CPAN::Fresh。然后做cpanm <module::name>
  • 检查刚刚安装的文件的权限是否正确

标签: perl perlbrew cpanm


【解决方案1】:

cpanm 不安装任何模块。它只是运行与您要安装的发行版一起打包的安装程序。通过PERL_MM_OPTPERL_MB_OPT 环境变量,您指示这些安装程序将模块安装在错误的位置。摆脱它们。

【讨论】:

  • 但安装不会根据使用的 cpanm 更改位置。我进行了建议。在 perlbrew 下使用 perl,找不到 DBD/Sybase.pm。使用系统 perl,一切都很好。 /Users/john/perl5/lib/perl5/darwin-thread-multi-2level/DBD/Sybase.pm。想让某些 cpanm 下次安装是为了 perlbrew 复制
  • PERL5LIB="/Users/john/perl5/lib/perl5" 这就是问题所在。我如何将文件从这里移动到 ~/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/
  • 非常感谢您提供的信息。不知道我是怎么走到这一步的。
  • Re "but won't the installs change location based on which cpanm is used", 默认情况下,perl 使用的将确定模块的安装位置,但你是覆盖它。
  • Re "如何将文件从这里移动到 ~/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/" 不要移动他们。只需使用您希望它们可用的 Perl 安装模块。
【解决方案2】:

我遇到了类似的问题,无法理解如何让cpanm 为预期的 Perl 安装模块。我通过以下方式安装了perlbrew

perlbrew --switch --notest install perl-stable

我认为--switch 会将我的用法指向新的 Perl,我可以通过以下方式看到新的 Perl:

perlbrew exec perl -v | grep 'This is'

但是当我通过以下方式运行我的脚本时,使用cpanm 安装模块不起作用(找不到模块):

perlbrew exec perl myscript.pl

这个which-version-of-perl post 让我觉得--switch 可能没有达到我想要的效果。运行以下命令允许cpanm 开始安装到预期的 Perl:

perlbrew switch perl-5.26.1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-30
    • 2020-01-02
    • 2011-10-11
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    相关资源
    最近更新 更多