【问题标题】:Why can't my CPAN client from MacPorts find Module::Build?为什么我的 MacPorts 的 CPAN 客户端找不到 Module::Build?
【发布时间】:2011-04-04 08:56:49
【问题描述】:

我在雪豹中使用 macports。我想安装某些 perl 模块以便能够运行脚本。确切地说是 DateTime 模块。我该怎么做呢?我尝试使用以下命令。

perl -MCPAN -e shell
cpan > install DateTime

但它仍然说找不到 DateTime.pm。我做错了什么?

编辑:我认为我没有正确配置 CPAN。我收到了错误

Can't locate Module/Build.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 .) at Build.PL line 5.
BEGIN failed--compilation aborted at Build.PL line 5.
Warning: No success on command[/opt/local/bin/perl Build.PL ]
Warning (usually harmless): 'YAML' not installed, will not store persistent state
  DROLSKY/DateTime-0.61.tar.gz
  /opt/local/bin/perl Build.PL  -- NOT OK
Running Build test
  Make had some problems, won't test
Running Build install
  Make had some problems, won't install
Could not read '/Users/xxxxxx/.cpan/build/DateTime-0.61-ZNYzBn/META.yml'. Falling back to other methods to determine prerequisites
  Warning: CPAN.pm discovered Module::Build as undeclared prerequisite.
  Adding it now as such.

我需要先做点别的吗?

【问题讨论】:

  • 你能给出确切的错误信息吗?
  • 你去 :)。我很确定我错过了一些非常基本的东西。
  • 当您尝试安装 Module::Build 时会发生什么?在 Perl 5.10 之前,这不是核心模块,而您使用的是 5.8。
  • 你也应该安装 YAML;这将使 cpan 安装更容易,更不容易出错。

标签: perl cpan perl-module macos


【解决方案1】:

最简单的解决方案,因为您使用的是 macports 中的 perl,所以也可以从 macports 中安装 DateTime:

sudo port install p5-datetime

【讨论】:

    【解决方案2】:

    DateTime 使用 META.json - 尚不支持。所以先安装 Module::Build 。升级 CPAN 也是一个好主意。

    【讨论】:

      【解决方案3】:

      您最好检查一下您的防火墙配置。 CPAN 对服务器的访问可能会被阻止。无论如何,您可以下载并手动安装模块:http://search.cpan.org/dist/DateTime/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-09-22
        • 1970-01-01
        • 1970-01-01
        • 2018-10-14
        • 2017-04-02
        • 2012-06-26
        • 1970-01-01
        相关资源
        最近更新 更多