【发布时间】:2014-01-23 11:20:18
【问题描述】:
我在示例的帮助下编写了一些代码,但是当我运行它时,我在 Ubuntu Server 12.04.2 LTS 中遇到错误:
Failed to connect to , problem connecting to "localhost", port 4242: Connection refused at /usr/local/share/perl/5.14.2/MozRepl/Client.pm line 144
我该如何解决这个问题?
#!/usr/bin/perl -w
use strict;
use WWW::Mechanize::Firefox;
use HTTP::Cookies;
my $username = "test";
my $password = "t3st";
my $mech = WWW::Mechanize::Firefox->new();
$mech->get("http://test.com/login.php"); print "Logging, Please Wait.\n";
$mech->submit_form(
form_number => 0,
fields => {
username => "$username",
password => "$password",
}
);
【问题讨论】:
-
你试过
localhost 0 4242吗? -
这不是 Perl 问题。您的问题是:1.,没有服务(例如 mozrepl)正在侦听 localhost 端口 4242,或 2.,您的防火墙正在阻止或操纵端口 4242 上的 localhost 流量,导致与它的连接立即失败。
标签: perl ubuntu-12.04 www-mechanize-firefox