Reputation: 1191
I am creating a short Perl Script. I am using the WWW::Mechanize::Firefox
module. When I instantiate the object, I believe the module fails to establish a connection with the MozRepl component in Firefox.
My code is as follows:
use WWW::Mechanize::Firefox;
my $mech = WWW::Mechanize::Firefox->new();
When I run the code, I get the following error message
Failed to connect to , problem connecting to "localhost", port 4242: Connection refused at /usr/local/share/perl/5.12.4/MoxRepl/Client.pm line 144'
I just installed and updated all relevant software I can think of
I tried adjusting the firewall to open port 4242. Nothing is working. Any ideas?
A similar error code appears in this Stack Overflow question
Update
Ok, Borodin's answer actually fixed 2 problems.
WWW::Mechanize::Firefox->new() only works when
I had expected the Perl script to act like a shell script, and start Firefox for me. This is not the case.
Also, if you hide the menu bar in Firefox, the "Tools" menu is the only menu that is not accessible in the drop-down list that appears on the top left. You have to show the menu bar to access the "Tools" menu.
Upvotes: 3
Views: 2245
Reputation: 126722
You need to start the MozRepl add-on in Firefox.
Go to Tools / MozRepl and click on Start
Your program should now work.
Upvotes: 7