2011-09-14 22 views
4

我剛剛安裝WWW:Mechanize::Firefox,但是當我試圖創建這個「類」的一個實例:無法創建WWW的一個實例:機械化::火狐

my $mech = WWW::Mechanize::Firefox->new(); 

我得到這個錯誤:

Failed to connect to , problem connecting to "localhost", port 4242: 
No connection could be made because the target machine 
actively refused it. 
at C:/strawberry/perl/site/lib/MozRepl/Client.pm line 144 

任何人都可以幫忙嗎?

+0

監聽連接你能張貼一些代碼?另外,如果你telnet到localhost會發生什麼:4242 – Eamorr

+0

這段代碼太簡單了,因爲這個錯誤在開頭:使用WWW:Mechanize :: Firefox; $ mech = WWW :: Mechanize :: Firefox-> new();打印「blabla」;但它不會因爲之前退出:s – eliane

+0

和抱歉,我不熟悉telnet和基本聯網! – eliane

回答

7

您必須安裝mozrepl並在菜單Tools → MozRepl → Start中啓動它。

+0

我如何在Firefox中找到Tools-> MozRepl?搜索整個佈局,沒有什麼 – Grigor

+2

@Grigor:右鍵單擊新firefox中的任何工具欄(不是選項卡):然後單擊菜單欄以查看菜單欄。然後出現菜單欄,它是tools-> mozrepl-> Start – surfer190

2

除了安裝和啓動火狐/ mozrepl,主動拒絕連接經常是防火牆的工作,所以你需要學會工作的本地防火牆允許mozrepl從本地主機