cat_baby has asked for the wisdom of the Perl Monks concerning the following question:

Hello, wise Perl friends.

I have spent the better part of the night attempting to install WWW::Mechanize, researching issues, and repeatedly repairing permissions via my OS X Disk Utility to no avail. The key word 'permissions' keeps reappearing although I've tried typing "sudo" before everything and entering my password and that doesn't help. I hope the problem is with the module and not my configuration of Perl, but just in case, here's what it's telling me:

Test Summary Report ------------------- t/local/click_button.t (Wstat: 0 Tests: 19 Failed: 0) TODO passed: 15-17, 19 t/local/nonascii.t (Wstat: 65280 Tests: 4 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 5 tests but ran 4. Files=54, Tests=578, 19 wallclock secs ( 0.34 usr 0.17 sys + 9.18 cu +sr 1.39 csys = 11.08 CPU) Result: FAIL Failed 1/54 test programs. 0/578 subtests failed. make: *** [test_dynamic] Error 255 JESSE/WWW-Mechanize-1.68.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, t +ry: reports JESSE/WWW-Mechanize-1.68.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: JESSE/WWW-Mechanize-1.68.tar.gz : make_test NO

As I said, I've tried repairing permissions, tried updating CPAN, I even installed cpanm and tried cpanm WWW::Mechanize. I got a different failure under that:

! ! Can't write to /Library/Perl/5.10.0 and /usr/local/bin: Installing m +odules to /Users/Jared/perl5 ! To turn off this warning, you have to do one of the following: ! - run me as a root or with --sudo option (to install to /Library/P +erl/5.10.0 and /usr/local/bin) | - run me with --local-lib option e.g. cpanm --local-lib=~/perl5 ! - Set PERL_CPANM_OPT="--local-lib=~/perl5" environment variable (i +n your shell rc file) ! - Configure local::lib in your shell to set PERL_MM_OPT etc. ! --> Working on WWW::Mechanize Fetching http://search.cpan.org/CPAN/authors/id/J/JE/JESSE/WWW-Mechani +ze-1.68.tar.gz ... OK Configuring WWW-Mechanize-1.68 ... OK Building and testing WWW-Mechanize-1.68 ... FAIL ! Installing WWW::Mechanize failed. See /Users/Jared/.cpanm/build.log +for details.

Monks, I am truly at my wits end with this and hoping I did not permanently disfigure some 'behind the scenes' aspects of my operating system in which I am woefully ill-versed. Thank you for your help.

Replies are listed 'Best First'.
Re: Hell of a time installing module WWW::Mechanize
by Khen1950fx (Canon) on Apr 28, 2011 at 07:37 UTC
    Your CPAN test results weren't that bad, so looking at CPAN again, it seems that you could be missing some dependencies. WWW::Mechanize has a slough of dependencies that must be installed or updated. One dependency that always bothers me is HTTP::Server::Simple. I've always had to force install it.

    Here's a cpan script to install and upgrade the dependencies:

    #!/usr/bin/perl use strict; use warnings; use CPAN; CPAN::Shell->install( "Tree::DAG_Node", "Test::Warn", "WWW::RobotRules", "HTTP::Cookies", "Net::FTP", "Net::HTTP", "Digest::base", "Digest::MD5", "HTTP::Negotiate", "File::Listing", "LWP::UserAgent", "HTML::Form", "HTTP::Daemon", "Test", "Text::Wrap", "Pod::Escapes", "Pod::Simple", "Pod::Man", "ExtUtils::MakeMaker", "HTTP::Server::Simple", "Time::Local", "HTTP::Date", "MIME::Base64", "URI", "Encode", "Encode::Locale", "LWP::MediaTypes", "Compress::Raw::Bzip2", "Compress::Raw::Zlib", "IO::Uncompress::Inflate", "HTTP::Status", "ExtUtils::ParseXS", "Module::CoreList", "Module::Load", "Params::Check", "Module::Load::Conditional", "Locale::Maketext::Simple", "IPC::Cmd", "ExtUtils::CBuilder", "Perl::OSType", "IO::Dir", "Version::Requirements", "Exporter", "CPAN::Meta::YAML", "JSON::PP", "Parse::CPAN::Meta", "CPAN::Meta", "Scalar::Util", "File::Spec", "File::Temp", "version", "Module::Metadata", "Module::Build", "HTML::Tagset", "XSLoader", "HTML::Parser", "Sub::Uplevel", "Test::Exception", "HTML::TreeBuilder", "Test::Harness", "Test::More", "Pod::Usage", "WWW::Mechanize");
      This script did the trick for me. Many thanks!
      Thank you so much. I was having this same problem and installing and upgrading the dependencies did the trick. Why doesn't CPAN take care of that?

        Thank you so much. I was having this same problem and installing and upgrading the dependencies did the trick. Why doesn't CPAN take care of that?

        CPAN does take care of this

      Thanks, this resolved my problem installing Mechanized as well.
Re: Hell of a time installing module WWW::Mechanize
by Anonymous Monk on Apr 28, 2011 at 06:22 UTC
    On the first one it tells you make test had returned bad status, won't install without force, so if you wish to install, use force

    $ perldoc cpan |grep -i force -C2 and CPAN version. -f Force the specified action, when it normally would have failed +. Use this to install a module even if its tests fail. When you use +this option, -i is not optional for installing a module when you ne +ed to force it: % cpan -f -i Module::Foo -- cpan -i Netscape::Booksmarks Business::ISBN # force install modules ( must use -i ) cpan -fi CGI::Minimal URI -- CREDITS Japheth Cleaver added the bits to allow a forced install (-f). Jim Brandt suggest and provided the initial implementation for the

    On the second one a similar instruction

    ! - run me as a root or with --sudo option | - run me with --local-lib option !
    so either run it as root (administrator) or use --sudo , or run with --local-lib . You can also use this instead of --local-lib
    export PERL_MB_OPT=--install_base /home/user/devstuff export PERL_MM_OPT=INSTALL_BASE=/home/user/devstuff export PERL5LIB=/home/user/devstuff/perl5 cpanp i WWW::Mechanize --force --skiptest