Corion / WWW-Mechanize-Chrome

automate the Chrome browser

Home Page:https://metacpan.org/release/WWW-Mechanize-Chrome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't locate object method "new" via package "Chrome::DevToolsProtocol::Transport::NetAsync"

KES777 opened this issue · comments

After upgrading WWW-Mechanize-Chrome from 0.28 to 0.40 I get the error:

Can't locate object method "new" via package "Chrome::DevToolsProtocol::Transport::NetAsync" (perhaps you forgot to load "Chrome::DevToolsProtocol::Transport::NetAsync"?) at /home/kes/work/projects/tucha/monkeyman/local/lib/perl5/Chrome/DevToolsProtocol/Transport.pm line 44

_

  1. If there are some implementation running
  2. default is not tried
  3. But if reloading failed (if it is already in the memory (@inc) why you try to require it again?)
  4. the default is returned (without trying to load it)

The cause why eval require failed:

Can't locate Chrome::DevToolsProtocol::Transport::Mojo in @INC

Actually Can't locate Chrome::DevToolsProtocol::Transport::Mojo is in INC. It failed to loaded because:

Can't locate Future/Mojo.pm in @INC (you may need to install the Future::Mojo module)

Future::Mojo is no installed at all. Is this missed dependency?

After installing Future::Mojo manually I get different error:

Future::Mojo=HASH(0xf635cb8) Future::Mojo=HASH(0xf635cb8) lost a sequence Future at /home/kes/work/projects/tucha/monkeyman/local/lib/perl5/Chrome/DevToolsProtocol/Transport/Mojo.pm line 66.

Hmm - these are two errors. The first (4) of not loading $default is easily fixed (soon to be pushed).

The second problem is that the module only explicitly specifies the prerequisites for IO::Async. If you want AnyEvent, you need AnyEvent::Future, if you want Mojolicious support, you need Future::Mojo installed. Then, there should be no lost Futures anywhere. Do you have (short) code to reproduce that error message?

I think I now understand your picture. If you want to try WWW::Mechanize::Chrome with Mojolicious, you have to install Future::Mojo.

Thank you for fast fix.

If you want to try WWW::Mechanize::Chrome with Mojolicious, you have to install Future::Mojo.

Probably WWW::Mechanize::Chrome should not try Mojolicious if there is no required modules in the system. As you can see I have only half of them: Mojolicious and missed Future::Mojo

huh ( This happens again:

[2020-02-10 21:04:34.08923] [25] [error] [b352ee13] Can't locate object method "new" via package "Chrome::DevToolsProtocol::Transport::NetAsync" (perhaps you forgot to load "Chrome::DevToolsProtocol::Transport::NetAsync"?) at /opt/monkeyman/local/lib/perl5/Chrome/DevToolsProtocol/Transport.pm line 44.

My project installs this modules:
cpanfile.txt

in my project I do:

	$Chrome::DevToolsProtocol::Transport::implementation =
		$Chrome::DevToolsProtocol::Transport::default;

When I finally did in my application:

 use Chrome::DevToolsProtocol::Transport::NetAsync;

then everything starts to work