perlperl-modulecpanwww-mechanize

Installing WWW::Mechanize – Error GETing localhost: Can't connect to localhost


I am using the command

sudo perl -MCPAN -e 'install WWW::Mechanize' 

to try and install WWW::Mechanize on macOS, and kept getting the error

1/13 Error GETing http://localhost:51623/: Can't connect to localhost:51623 (Connection refused) at t/local/referer.t line 39. 

I somewhat fixed this by changing the file /etc/hosts by adding a -v6 at the end of the second instance of the word "localhost". /etc/hosts now reads

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost-v6 

Now, at the end of the installation process, I get this Test Summary Report:

t/live/wikipedia.t     (Wstat: 512 Tests: 1 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=58, Tests=608, 69 wallclock secs ( 0.25 usr  0.11 sys +  8.25 cusr  1.28 csys =  9.89 CPU)
Result: FAIL
Failed 1/58 test programs. 0/608 subtests failed.
make: *** [test_dynamic] Error 255
  OALDERS/WWW-Mechanize-1.78.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports OALDERS/WWW-Mechanize-1.78.tar.gz
Running make install
  make test had returned bad status, won't install without force

How can I install WWW::Mechanize?


Solution

  • The (only) failed test I get when installing without force failed due to the certificate authenticity of the wikipedia page that was being used. After force installing WWW::Mechanize, the module works fine.