trouble installing MozRepl

2.3k views Asked by At

I've been trying to install WWW::Mechanize::Firefox through CPAN and I am having trouble installing the dependency MozRepl. The installation goes through but the tests all fail, and when I force install it and run my perl script, I run into an error

Failed to connect to ,  at /Library/Perl/5.12/MozRepl/RemoteObject.pm line 467.

SO I uninstalled MozRepl and looked at the tests I get the following errors in the log:

#   Failed test at t/10-plugin-repl-enter.t line 11.
Can't locate object method "repl_enter" via package "MozRepl" at t/10-plugin-repl-enter.t line 12.

...

#   Failed test at t/20-plugin-json.t line 16.
Can't locate object method "json" via package "MozRepl" at t/20-plugin-json.t line 17.

#   Failed test at t/19-plugin-repl-util-doc_for.t line 14.
Can't locate object method "repl_doc_for" via package "MozRepl" at t/19-plugin-repl-util-doc_for.t line 16.

#   Failed test at t/18-plugin-repl-util-help_url_for.t line 14.
Can't locate object method "repl_help_url" via package "MozRepl" at t/18-plugin-repl-util-help_url_for.t line 16.

etc..

I am running on Mac OSX 10.8.4, 4 GB Ram 2.5 Ghz, Perl version 5.12. Does anybody have any idea what is causing these errors?

UPDATE: i reinstalled mozrepl, and now I get this error when i run my script:

Failed to connect to , problem connecting to "localhost", port 4242: Connection refused at /Users/thui/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/MozRepl/Client.pm line 144
1

There are 1 answers

1
David-SkyMesh On

This works for me with perl 5.10 or later, latest Firefox (26 as of writing) and Mozrepl from github.

At command propmpt:

(1) Download MozRepl and build the XPI file (Firefox extension):

git clone git://github.com/bard/mozrepl
cd mozrepl
zip -r ../mozrepl.zip *
cd ..
mv mozrepl.zip mozrepl.xpi

(2) Install the extension in Firefox via about:addons [Install from file].

In Firefox:

(3) Menu->Tools->Mozrepl->Activate On Startup

(4) Menu->Tools->Mozrepl->Start

At command propmpt:

(5) which firefox

Make sure the firefox executable (or your OS's wrapper script) is in $PATH - you should get some output!

(6) cpanm WWW::Mechanize::Firefox

(7) Test it!

At this point, if CPANminus reports no errors then WWW::Mechanize::Firefox should be working. The first example from the synopsis is a good test:

#!/usr/bin/perl
use WWW::Mechanize::Firefox;
my $mech = WWW::Mechanize::Firefox->new();
$mech->get('http://google.com');

That assumes MozRepl is listening on port 4242 (check in Menu->Tools->Mozrepl->Change Port). You can also change the port from the perl side; see options for ->new().

(8) cpanm HTML::Display::Common

I found that bcat.pl from the examples required this module, but it wasn't installed as a dependency.