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

I tried to run:

use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); $mech->get('http://google.com'); $mech->eval_in_page('alert("Hello Firefox")'); my $png = $mech->content_as_png();

and got:

Can't locate object method "dive" via package "MozRepl::RemoteObject:: +Methods" at /usr/local/ActivePerl-5.12/site/lib/WWW/Mechanize/Firefox +.pm line 220, <DATA> line 1.

I have WWW::Mechanize::Firefox 0.65, MozRepl::RemoteObject::0.31, MozRepl::0.06 installed.

Any help is greatly appreciated.

Replies are listed 'Best First'.
Re: Method dive not found on WWW::Mechanize::Firefox / MozRepl::RemoteObject
by Corion (Patriarch) on Apr 10, 2012 at 14:18 UTC

    Ouch. It seems that this is broken and the version of MozRepl::RemoteObject that fixes this is not yet released on CPAN. The workaround fix is likely adding these lines at the start of your script until you can upgrade to v0.32 of MozRepl::RemoteObject:

    use MozRepl::RemoteObject; BEGIN { if( ! *MozRepl::RemoteObject::Methods::dive{ CODE } ) { *MozRepl::RemoteObject::Methods::dive = \&MozRepl::RemoteObjec +t::__dive; }; }; use WWW::Mechanize::Firefox;

      Make that:

      use MozRepl::RemoteObject; BEGIN { if( ! *MozRepl::RemoteObject::Methods::dive{ CODE } ) { *MozRepl::RemoteObject::Methods::dive = \&MozRepl::RemoteObjec +t::Instance::__dive; }; }; use WWW::Mechanize::Firefox;

        Should be fixed now, as v0.32 of MozRepl::RemoteObject is on its way to the CPAN mirrors.

      That worked.

      Many thanks indeed

      Adriano