I installed W3C Validator on my Mac OS X Yosemite. I followed these instructions: https://validator.w3.org/docs/install.html
Here is the command I tried:
/usr/local/validator/cgi-bin/check uri=http://www.w3.org
I am getting this error:
<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.
check line 47:
use Config::General 2.32 qw(); # Need 2.32 for <msg 0>, rt.cpan.org#17852
I did a search on my computer for:
sudo find / -name General.pm
I got this this result:
/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
More details about my setup for perl:
$ which perl
/usr/bin/perl
$ perl --version
This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level (with 2 registered patches, see perl -V for more detail)
Copyright 1987-2013, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
How can I solve this?
I had the same problem, and got past it by simply adding
sudo
when invokingcpan
— not just forConfig::General
, but for all the dependencies:Having done that, the w3c validator now works fine for me.
I’m not knowledgeable enough to be confident whether this is a good approach. In other contexts, one’s often warned against installing things with
sudo
. Various people (e.g. the answers to this question) suggest that it’s OK to usesudo
forcpan
in general; however, they don’t discuss the Mac OS X context specifically. This question gives an alternative possibility (tellingcpan
to install to a different location), but I didn’t find it until after already falling back onsudo
.