Mac OS X上的W3C Validator发送此错误:找不到Config / General.pm

时间:2015-06-25 05:07:06

标签: macos perl w3c w3c-validation

我在Mac OS X Yosemite上安装了W3C Validator。我按照这些说明操作:https://validator.w3.org/docs/install.html

这是我试过的命令:

  

/ usr / local / validator / cgi-bin / check uri = http://www.w3.org

我收到此错误:

<h1>Software error:</h1>
<pre>Can't locate Config/General.pm in @INC (you may need to install the Config::General module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18) at /usr/local/validator/cgi-bin/check line 47.
BEGIN failed--compilation aborted at /usr/local/validator/cgi-bin/check line 47.
</pre>
<p>
For help, please send mail to this site's webmaster, giving this error message 
and the time and date of the error.

</p>
[Thu Jun 25 01:04:18 2015] check: Can't locate Config/General.pm in @INC (you may need to install the Config::General module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18) at /usr/local/validator/cgi-bin/check line 47.
[Thu Jun 25 01:04:18 2015] check: BEGIN failed--compilation aborted at /usr/local/validator/cgi-bin/check line 47.

检查第47行:

use Config::General 2.32 qw();    # Need 2.32 for <msg 0>, rt.cpan.org#17852

我在我的电脑上搜索了:

  

sudo find / -name General.pm

我得到了这个结果:

/Applications/Validator-SAC.app/Contents/Resources/validator/lib/perl5.10/Config/General.pm
/Applications/Validator-SAC.app/Contents/Resources/validator/lib/perl5.10.0/Config/General.pm
/Applications/Validator-SAC.app/Contents/Resources/validator/lib/perl5.12/Config/General.pm
/Applications/Validator-SAC.app/Contents/Resources/validator/lib/perl5.18/Config/General.pm
find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory
/System/Library/Perl/Extras/5.16/Config/Any/General.pm
/System/Library/Perl/Extras/5.18/Config/Any/General.pm
/Users/jeannicolas/.cpan/build/Config-General-2.58-ICngmR/blib/lib/Config/General.pm
/Users/jeannicolas/.cpan/build/Config-General-2.58-ICngmR/General.pm
/Users/jeannicolas/.cpan/build/Config-General-2.58-umQC4D/blib/lib/Config/General.pm
/Users/jeannicolas/.cpan/build/Config-General-2.58-umQC4D/General.pm
/Users/jeannicolas/perl5/lib/perl5/Config/General.pm
/usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/General.pm
/usr/local/Cellar/automake/1.14/share/automake-1.14/Automake/General.pm

有关perl设置的更多详细信息:

$  which perl
  

的/ usr /斌/ perl的

$  perl --version
  

这是perl 5,版本18,颠覆2(v5.18.2)   darwin-thread-multi-2level(有2个注册的补丁,请参阅perl -V for   更多细节)

     

版权所有1987-2013,Larry Wall

     

Perl只能根据艺术许可的条款进行复制   或GNU通用公共许可证,可以在Perl 5中找到   源工具包。

     

应找到Perl的完整文档,包括常见问题列表   在这个系统上使用“man perl”或“perldoc perl”。如果您有权限   在互联网上,将浏览器指向http://www.perl.org/,即Perl   主页。

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,只是在调用sudo时添加了cpan - 不仅仅针对Config::General,而是针对所有依赖项:

sudo cpan install Bundle::W3C::Validator

完成后,w3c验证器现在可以正常使用。

我不足以确信这是否是一种好方法。在其他情况下,人们常常警告不要使用sudo安装内容。不同的人(例如the answers to this question)建议将sudo用于cpan一般是可以的;但是,他们没有具体讨论Mac OS X环境。 This question提供了另一种可能性(告诉cpan安装到其他位置),但直到我已经回到sudo之后才找到它。