0

我遇到了以下问题,我不知道是什么介绍了它,但是 Mac 上的 perl 包含路径总是一场噩梦;

cpan[1]> install DateTime::Event::Recurrence
Going to read '/Users/Hristo/.cpan/Metadata'
  Database was generated on Tue, 08 Jan 2013 11:07:23 GMT
Fetching with LWP:
http://ftp.belnet.be/mirror/ftp.cpan.org/authors/01mailrc.txt.gz
Catching error: "Can't locate HTML/HeadParser.pm in \@INC (\@INC contains: /opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.12.4 /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.12.4 /opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/5.12.4 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl /Users/Hristo) at /opt/local/lib/perl5/site_perl/5.12.4/LWP/UserAgent.pm line 663, <FIN> line 1. at /opt/local/lib/perl5/site_perl/5.12.4/LWP/UserAgent.pm line 915, <FIN> line 1.\cJ" at /opt/local/lib/perl5/5.12.4/CPAN.pm line 391, <FIN> line 1.
    CPAN::shell() called at /opt/local/lib/perl5/5.12.4/App/Cpan.pm line 295
    App::Cpan::_process_options('App::Cpan') called at /opt/local/lib/perl5/5.12.4/App/Cpan.pm line 364
    App::Cpan::run('App::Cpan') called at /opt/local/bin/cpan line 11
Fetching with LWP:
http://ftp.belnet.be/mirror/ftp.cpan.org/authors/01mailrc.txt.gz
Terminal does not support GetHistory.
Lockfile removed.
Can't locate HTML/HeadParser.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.12.4 /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.12.4 /opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/5.12.4 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl /Users/Hristo) at /opt/local/lib/perl5/site_perl/5.12.4/LWP/UserAgent.pm line 663, <FIN> line 1. at /opt/local/lib/perl5/site_perl/5.12.4/LWP/UserAgent.pm line 915, <FIN> line 1.

在 /opt/local/lib/perl5/site_perl/5.12.4/darwin-multi-2level/HTML CPAN 中有 HTML::HeadParser 在此之前已经工作了几个月。

如何更改@INC 系统范围内的内容,以便 IDE (Eclipse) 和 CPAN 都知道如何查看。我一直在对 Makefile.PL 进行全局文件搜索,使用诸如sudo find / -name "*.PL" | xargs grep "Makefile"在各种情况下尝试找到它并尝试此建议等命令,但到目前为止没有成功。(哦,我多么讨厌这个操作系统 :))

4

2 回答 2

1

我不知道确切的解决方案,可能这个链接会有所帮助..

Perl 的@INC 是如何构造的?(又名影响 Perl 模块搜索位置的所有方法是什么?)

于 2013-03-12T11:59:31.383 回答
0

如果$Config{usesitecustomize}已定义,您可以查找sitecustomize.plat $Config{sitelib}\\sitecustomize.pl。见perlrun

%Config变量告诉你 perl 是如何编译运行的,所以需要重新编译来改变它。

除此之外,您还可以更改任何正在运行的通用登录脚本——如果有的话——以便环境变量PERL5LIB包含你的路径——我相信环境变量PERLLIB仍然可以正常工作。

于 2013-03-12T11:21:34.627 回答