nysus has asked for the wisdom of the Perl Monks concerning the following question:
I'm a newb with Moose. I have the following perl script which creates an FFMech object:
#!/usr/bin/perl BEGIN { unshift @INC, "/home/steve/perl/perl-lib" } use strict; use warnings; use FFMech; my $ffm = FFMech->new;
The code for the FFMech object is here:
package FFMech; use strict; use warnings; $ENV{'DISPLAY'} = ':0.0'; use X11::GUITest qw/SendKeys FindWindowLike ClickWindow SetEventSendDe +lay/; use Moose; extends 'WWW::Mechanize::Firefox'; has 'window_id' => ( is => 'ro', isa => 'Int', );
As you can see, the class doesn't do anything. That's because I can't get over the initial hump of initializing the object without getting the following error:
Failed to connect to , problem connecting to "localhost", port 4242: C +onnection refused at /usr/local/share/perl/5.20.2/MozRepl/Client.pm l +ine 144
The error is occurring because Firefox is not running. You can launch Firefox with something like:
my $mech->new(launch => 'firefox');
However, I'm at a loss as to how to pass these arguments to the constructor for the WWW::Mechanize::Firefox object.
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
$nysus = $PM . $MCF;
Click here if you love Perl Monks
|
|---|