添加到全局PERL @INC的路径,系统范围,而不是我的脚本,但是全局。在Mac上

时间:2013-03-12 11:14:50

标签: perl cpan

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

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中有HTML :: HeadParser CPAN在此之前已经工作了几个月。

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

2 个答案:

答案 0 :(得分:1)

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

How is Perl's @INC constructed? (aka What are all the ways of affecting where Perl modules are searched for?)

答案 1 :(得分:0)

如果定义了$Config{usesitecustomize},您可以在sitecustomize.pl查找$Config{sitelib}\\sitecustomize.pl。请参阅perlrun

%Config变量告诉您​​perl如何编译运行,因此需要重新编译才能更改它。

除此之外,您还可以更改运行的任何通用登录脚本(如果有),以便环境变量PERL5LIB包含您的路径 - 我相信环境变量PERLLIB仍然有用。