Corion / WWW-Mechanize-Chrome

automate the Chrome browser
https://metacpan.org/release/WWW-Mechanize-Chrome
Artistic License 2.0
30 stars 12 forks source link

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

Closed KES777 closed 4 years ago

KES777 commented 5 years ago

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)
KES777 commented 5 years ago

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?

KES777 commented 5 years ago

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.
Corion commented 5 years ago

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?

Corion commented 5 years ago

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

KES777 commented 5 years ago

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

KES777 commented 4 years ago

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;
KES777 commented 4 years ago

When I finally did in my application:

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

then everything starts to work