Use perl WWW:Mechanize on MacOS Big Sur

Viewed 226

I want to use WWW:Mechanize with perl on BigSur. My Perl:

    perl 5, version 34, subversion 0 (v5.34.0)

I could install perl as far as using the modules:

    DBI; 
    LWP::UserAgent; 
    LWP::Simple qw /get/; 
    HTML::TreeBuilder; 
    HTML::Parser;URI qw();

Trying to use
WWW:: Mechanize;

fails with:

    Can't locate WWW/Mechanize.pm in @INC (you may need to install the WWW::Mechanize module)
@INC contains: 
/usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0/darwin-thread-multi-2level 
/usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0
/usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0/darwin-thread-multi-2level 
/usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0 
/usr/local/lib/perl5/site_perl/5.34.0)

I tryed to load WWW:Mechanize with

sudo cpanm WWW::Mechanize

with the answer:

WWW::Mechanize is up to date. (2.03)

But WWW::Mechanize is still not seen by BBEdit.

How can I achieve this?

1 Answers

Try installing the module with the cpan that comes with the homebrew perl:

% /usr/local/Cellar/perl/5.34.0/bin/cpan WWW::Mechanize

And, to help us with your answer:

  • give us the output of which cpanm and first line of that file to see the shebang.
  • can you load the other modules with the homebrew perl? You might have installed them into a different place.
#!/usr/local/Cellar/perl/5.34.0/bin/perl
use DBI; 
use LWP::UserAgent; 
use LWP::Simple qw /get/; 
use HTML::TreeBuilder; 
use HTML::Parser;
use URI qw(); 
Related