简体   繁体   中英

trouble installing MozRepl

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

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

At command propmpt:

Download MozRepl and build the XPI file (Firefox extension): 下载MozRepl并构建XPI文件(Firefox扩展):

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

Install the extension in Firefox via about:addons [Install from file]. 通过about:addons [从文件安装]在Firefox中安装扩展。

In Firefox:

Menu -> Tools -> Mozrepl -> Activate On Startup Menu -> Tools -> Mozrepl > Activate On Startup

Menu -> Tools -> Mozrepl -> Start Menu -> Tools -> Mozrepl > Start

At command propmpt:

which firefox which firefox

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

cpanm WWW::Mechanize::Firefox cpanm WWW::Mechanize::Firefox

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() .

cpanm HTML::Display::Common cpanm HTML::Display::Common

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM