gurudutt.rv has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I was trying to use WWW::Mechanize::Firefox (version WWW-Mechanize-Firefox-0.66), i have installed MozRepl-RemoteObject-0.32. Trying to run this small piece of code on Ubuntu 10.04.4
#!/usr/bin/perl use strict; use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new( activate => 1, # bring the tab to the foreground ); $mech->get('http://google.com');
I get the following error.
Can't locate object method "new" via package "MozRepl" at /usr/local/s +hare/perl/5.10.1/MozRepl/RemoteObject.pm line 434.
Can someone suggest a workaround?

Replies are listed 'Best First'.
Re: MozRepl Error
by Corion (Patriarch) on Jul 23, 2012 at 07:40 UTC
Re: MozRepl Error
by aitap (Curate) on Jul 23, 2012 at 07:39 UTC

    Please, use <code>...</code> tags to show your code. How did you install WWW::Mechanize::Firefox? How did you install MozRepl::RemoteObject?

    Do you have all of these dependencies installed?

    $ cpanm --showdeps WWW::Mechanize::Firefox --> Working on WWW::Mechanize::Firefox Fetching http://www.cpan.org/authors/id/C/CO/CORION/WWW-Mechanize-Fire +fox-0.66.tar.gz ... OK Configuring WWW-Mechanize-Firefox-0.66 ... OK Scalar::Util~1.14 WWW::Mechanize::Link HTTP::Daemon Task::Weaken Shell::Command Object::Import LWP::Simple parent URI ExtUtils::MakeMaker WWW::Mechanize HTTP::Cookies URI::data HTTP::Date MozRepl::RemoteObject~0.31 perl~5.006 MIME::Base64 HTTP::Response HTML::Selector::XPath File::Basename Cwd

    Sorry if my advice was wrong.
Re: MozRepl Error
by Anonymous Monk on Jul 23, 2012 at 07:53 UTC
    Please install "MozRepl" addons in firefox. And then under firefox's Tools tab, you'll find an option called MoxRepl. Start that MozRepl and run your script. Also, make sure that WWW::Mechnize::Firefox is installed properly.
      cpan[3]> install WWW::Mechanize::Firefox CPAN: Storable loaded ok (v2.20) Going to read '/home/gurudutt/.cpan/Metadata' Database was generated on Mon, 02 Jul 2012 03:58:03 GMT CPAN: LWP::UserAgent loaded ok (v5.834) CPAN: Time::HiRes loaded ok (v1.9719) Warning: no success downloading '/home/gurudutt/.cpan/sources/authors/ +01mailrc.txt.gz.tmp9571'. Giving up on it. at /usr/share/perl/5.10/CP +AN/Index.pm line 225. Fetching with LWP: http://www.perl.org/CPAN/authors/01mailrc.txt.gz CPAN: YAML loaded ok (v0.71) Going to read '/home/gurudutt/.cpan/sources/authors/01mailrc.txt.gz' CPAN: Compress::Zlib loaded ok (v2.02) ...................................................................... +......DONE Fetching with LWP: http://www.perl.org/CPAN/modules/02packages.details.txt.gz Going to read '/home/gurudutt/.cpan/sources/modules/02packages.details +.txt.gz' ^R Database was generated on Wed, 25 Jul 2012 06:14:33 GMT .............. New CPAN.pm version (v1.9800) available. [Currently running version is v1.9402] You might want to try install CPAN reload cpan to both upgrade CPAN.pm and run the new version without leaving the current session. ..............................................................DONE Fetching with LWP: http://www.perl.org/CPAN/modules/03modlist.data.gz Going to read '/home/gurudutt/.cpan/sources/modules/03modlist.data.gz' ...................................................................... +......DONE Going to write /home/gurudutt/.cpan/Metadata WWW::Mechanize::Firefox is up to date (0.66). cpan[4]> install MozRepl::RemoteObject MozRepl::RemoteObject is up to date (0.32).
      Looks like both the packages are up to date. I have installed firefox but there is no UI on this machine, so not sure how to install the plugin from browser.

        I have installed firefox but there is no UI on this machine, so not sure how to install the plugin from browser.

        Last I checked, firefox won't run without a UI, so you need a UI