I recently installed 'www/p5-WWW-Mechanize' and wrote a short script.
my $mech = WWW::Mechanize->new();
Executing that, I get the following error:
Can't locate HTML/TokeParser.pm in @INC (you may need to install the HTML::TokeParser module) (@INC contains: /usr/local/lib/perl5/site_perl/mach/5.28 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.28/mach /usr/local/lib/perl5/5.28) at /usr/local/lib/perl5/site_perl/WWW/Mechanize.pm line 15.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/WWW/Mechanize.pm line 15.
Compilation failed in require at ./test.pl line 6.
BEGIN failed--compilation aborted at ./test.pl line 6.
According to the METACPAN info for WWW:Mechanize, the package HTML::TokeParser is a dependency.
There is currently no p5-HTML-TokeParser port, so it will need to be created. (Note that there is a p5-HTML-TokeParser-Simple port, though.)
I cannot reproduce the failure.
HTML::TokeParser is part of www/p5-HTML-Parser which is already a build/runtime dependency of www/p5-WWW-Mechanize. Please confirm that p5-HTML-Parser is installed which should be done automatically. For Perl 5.28, HTML::TokeParser should be installed at /usr/local/lib/perl5/site_perl/mach/5.28/HTML/TokeParser.pm. If you cannot find it, rebuild/reinstall both ports and try again.
The system on which I had this issue had perl5.28 with p5-HTML-Parser-3.72 installed (HTML::TokeParser was at version 3.69). I'm not sure why HTML::TokeParser wasn't found in my path, as it existed at /usr/local/lib/perl5/site_perl/mach/5.28/HTML/TokeParser.pm and had the correct permissions.
I recently reinstalled perl (pkg install -f perl5, which upgraded to perl 5.30), and I also reinstalled p5-HTML-Parser, and the problem is now resolved.