2

I'm trying to work out why a Perl module won't install on my server.

cpanm WWW::Mechanize

It processes stuff for ages, and then eventually dies with:

root@admin:~# cpanm WWW::Mechanize
--> Working on WWW::Mechanize
Fetching http://www.cpan.org/authors/id/O/OA/OALDERS/WWW-Mechanize-1.90.tar.gz ... OK
Configuring WWW-Mechanize-1.90 ... OK
Building and testing WWW-Mechanize-1.90 ... FAIL
! Installing WWW::Mechanize failed. See /root/.cpanm/work/1543994046.20570/build.log for details. Retry with --force to force install it.

The log file has stuff like this in:

t/00-report-prereqs.t .................... ok
t/add_header.t ........................... ok
t/aliases.t .............................. ok
t/area_link.t ............................ ok
t/autocheck.t ............................ ok
t/bad-request.t .......................... ok
t/clone.t ................................ ok
t/content.t .............................. ok
# Test server http://127.0.0.1:31546 as PID 20661
t/cookies.t .............................. ok
t/credentials-api.t ...................... ok
t/credentials.t .......................... ok
t/die.t .................................. ok
t/dump.t ................................. ok
t/field.t ................................ ok
t/find_frame.t ........................... ok
t/find_image.t ........................... ok
t/find_inputs.t .......................... ok
t/find_link-warnings.t ................... ok
t/find_link.t ............................ ok
t/find_link_id.t ......................... ok
t/form-parsing.t ......................... ok
t/form_with_fields.t ..................... ok
t/form_with_fields_passthrough_params.t .. ok
t/frames.t ............................... ok

#   Failed test '... and it was recorded in the history'
#   at t/history.t line 131.
#          got: '3'
#     expected: '2'
# Looks like you failed 1 test of 28.
t/history.t .............................. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/28 subtests 
t/image-new.t ............................ ok
t/image-parse.t .......................... ok
t/link-base.t ............................ ok
t/link-relative.t ........................ ok
t/link.t ................................. ok
t/local/back.t ........................... ok
t/local/click.t .......................... ok
t/local/click_button.t ................... ok
# Running tests against http://127.0.0.1:50871/?xml=1
t/local/content.t ........................ ok
t/local/encoding.t ....................... ok
t/local/failure.t ........................ ok
t/local/follow.t ......................... ok
t/local/form.t ........................... ok
t/local/get.t ............................ ok
t/local/nonascii.t ....................... ok
t/local/overload.t ....................... skipped: Mysteriously stopped passing, and I don't know why.
t/local/page_stack.t ..................... ok
t/local/post.t ........................... ok
t/local/referer.t ........................ ok
t/local/reload.t ......................... ok
t/local/submit.t ......................... ok
t/mech-dump/mech-dump.t .................. ok
t/new.t .................................. ok
t/regex-error.t .......................... ok
t/save_content.t ......................... ok
t/select.t ............................... ok
t/taint.t ................................ skipped: Test::Taint required for checking taintedness
t/tick.t ................................. ok
t/untaint.t .............................. ok
t/upload.t ............................... ok
t/uri.t .................................. ok
t/warn.t ................................. ok
t/warnings.t ............................. ok

Test Summary Report
-------------------
t/history.t                            (Wstat: 256 Tests: 28 Failed: 1)
  Failed test:  23
  Non-zero exit status: 1
Files=59, Tests=752, 1241 wallclock secs ( 0.29 usr  0.08 sys + 11.13 cusr  1.60 csys = 13.10 CPU)
Result: FAIL
Failed 1/59 test programs. 1/752 subtests failed.
Makefile:946: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255
-> FAIL Installing WWW::Mechanize failed. See /root/.cpanm/work/1543994046.20570/build.log for details. Retry with --force to force install it.

I see this in there, but I'm unsure what it means:

#   Failed test '... and it was recorded in the history'
#   at t/history.t line 131.
#          got: '3'
#     expected: '2'
# Looks like you failed 1 test of 28.
t/history.t .............................. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/28 subtests 

Any suggestions? I need this module for another module I'm trying to install :/

AnFi
  • 5,883
  • 1
  • 12
  • 26
Andrew Newby
  • 1,041
  • 1
  • 22
  • 48
  • Can you run the verbose test and add the output? – choroba Dec 05 '18 at 08:42
  • Is `WWW::Mechanize` version provided in Ubuntu repositories (1.75) too old? – AnFi Dec 05 '18 at 09:13
  • @choroba how would I do that? I'm just using the basic `cpanm` currently (instead of `perl -MCPAN ...`) – Andrew Newby Dec 05 '18 at 13:07
  • @AnFi I'm not sure what you mean. Are you saying 1.75 comes shipped as standard with Ubuntu 1.75? – Andrew Newby Dec 05 '18 at 13:07
  • Yes. See https://packages.ubuntu.com/xenial/libwww-mechanize-perl => Package: libwww-mechanize-perl (1.75-1) – AnFi Dec 05 '18 at 15:25
  • @AnFi thanks - that did it! Could you please put as an answer, so I can accept? – Andrew Newby Dec 05 '18 at 15:35
  • 1
    Don't get _anything_ from CPAN if it's already packaged for your distro and you don't absolutely need a newer version. – Michael Hampton Dec 05 '18 at 19:56
  • @MichaelHampton thanks. I just use cpan as its easier than trying to find the distro versions. I wouldn't even know where to look? (I only tried this one as it was suggested to me) – Andrew Newby Dec 06 '18 at 06:42
  • 2
    Not sure about Debian/Ubuntu. On Red Hat based systems you can simply query `yum whatprovides 'perl(WWW::Mechanize)'` and it will tell you which package to install. – Michael Hampton Dec 06 '18 at 14:50
  • @MichaelHampton thanks for that. Unfortunately I don't have "yum" on the server (and it seems a bit OTT installing it just to do that one command :)) – Andrew Newby Dec 07 '18 at 07:30
  • 1
    Well, you can always get rid of Ubuntu :) – Michael Hampton Dec 07 '18 at 14:38
  • @MichaelHampton haha. Well the main reason for going with it, was due to the new http2 stuff they supported with it on nginx. And TBH, now I don't really care to relearn / rebuild the whole server with something else :) (I spent weeks and weeks creating a bash script to build new servers with the minimum of hassle, so I could knock them out nice and quick ;)) – Andrew Newby Dec 07 '18 at 18:09

1 Answers1

7

Perl CPAN packages installed as Linux distribution packages [Debian/Ubuntu]

Install perl packages as your Linux distribution packages if possible.

It is possible for WWW::Mechanize on Ubuntu (and other Debian family distributions):

Ubuntu – Details of package libwww-mechanize-perl in xenial
Package: libwww-mechanize-perl (1.75-1)

AnFi
  • 5,883
  • 1
  • 12
  • 26