为什么MacPorts的CPAN客户端无法找到Module :: Build?

时间:2010-08-26 16:10:40

标签: perl cpan perl-module macos

我在雪豹中使用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.

我是否需要先做其他事情?

3 个答案:

答案 0 :(得分:3)

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

sudo port install p5-datetime

答案 1 :(得分:2)

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

答案 2 :(得分:0)

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