上調用未定義值的方法「標題」我只是在Facebook上使用WWW::Mechanize
模塊進行測試,當我嘗試運行下面的代碼時,它返回錯誤無法在WWW/Mechanize.pm行2566
位於C未定義的值無法調用 「頭」:/Strawberry/perl/vendor/lib/WWW/Mechanize.pm線2566
#!/usr/bin/perl -w
use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
# Connect to server
$mech->get("https://www.facebook.com");
$mech->success or die $mech->response->status_line;
# Log into server
$mech->field('email', '[email protected]');
$mech->field('pass', 'xxxxxxx');
$mech->click_button(value => 'Log In');
這對我工作得很好。請檢查代碼中的哪個語句導致錯誤。 'perl -MLWP -E'表示$ LWP :: VERSION''和'perl -MWWW :: Mechanize -E'表示$ WWW :: Mechanize :: VERSION''的輸出是什麼?請注意,您應該*總是*'使用嚴格'和'使用警告'全部''在您編寫的每個* perl程序的頂部。沒有'use strict'的地方就沒有必要使用'my',並且在shebang行上不需要'-w' – Borodin
$ LWP :: VERSION給我「無法定位對象方法」說「通過包」6.15「(也許你忘了加載」6.15「?」 和Mechanize :: VERSION是1.75 – Zachary
你必須有一個非常舊的Perl版本? – Borodin