MacOS – Trying to Install WWW:Mechanize and Getting Localhost Error

apachemacosperlterminal

Okay . . . I've been trying to install WWW::Mechanize through CPAN and it always chokes at this line:

t/local/back.t ........... 1/47 Error GETing http://localhost:60603/: Can't connect to localhost:60603 (Connection refused) at t/local/back.t line 53.

I doublechecked to make sure Apache 2.4.10 (installed by default through OS X Yosemite), ran the configtest and then went into the browser to make sure localhost and 127.0.0.1 were indeed being loaded.

I'm stumped . . . how can I get beyond this roadblock?

Adding more details. This is the make test and stops at t/local/back:

Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/00-load.t t/add_header.t t/aliases.t t/area_link.t t/autocheck.t t/clone.t t/content.t t/cookies.t t/credentials-api.t t/credentials.t t/die.t t/dump.t t/field.t t/find_frame.t t/find_image.t t/find_inputs.t t/find_link-warnings.t t/find_link.t t/find_link_id.t t/form-parsing.t t/form_with_fields.t t/frames.t t/image-new.t t/image-parse.t t/link-base.t t/link-relative.t t/link.t t/new.t t/pod-coverage.t t/pod.t t/regex-error.t t/save_content.t t/select.t t/taint.t t/tick.t t/untaint.t t/upload.t t/warn.t t/warnings.t t/local/back.t t/local/click.t t/local/click_button.t t/local/content.t t/local/encoding.t t/local/failure.t t/local/follow.t t/local/form.t t/local/get.t t/local/nonascii.t t/local/overload.t t/local/page_stack.t t/local/referer.t t/local/reload.t t/local/submit.t t/mech-dump/mech-dump.t

Best Answer

I commented out ipv6 localhost in /etc/hosts to fix this.