无法通过包“LWP :: UserAgent”找到对象方法“default_header”

时间:2013-06-16 05:43:28

标签: perl twitter lwp

我正在尝试测试Perl的Twitter模块以进行一些工作,并在运行时面对提到的主题行。我运行它的系统是AIX,Perl版本是5.8.8

代码。

#!/usr/bin/perl -w
use Net::Twitter::Lite;
use Scalar::Util 'blessed';
use strict;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;


my $consumer_key = "ck";
my $consumer_secret = "cs";
my $access_key = "ak";
my $access_secret = "as";


my $nt = Net::Twitter::Lite->new(
    consumer_key        => $consumer_key,
    consumer_secret     => $consumer_secret,
    access_token        => $access_key,
    access_token_secret => $access_secret,
);

$nt->update("Status Update from Perl!");

错误:

Can't locate object method "default_header" via package "LWP::UserAgent"
   at /ts/vb/perl5/lib/perl5/Net/Twitter/Lite.pm line 104.

1 个答案:

答案 0 :(得分:3)

Net :: Twitter :: Lite可能正在使用一个功能,该功能是在比您安装的版本更高的版本中添加到LWP :: UserAgent的。升级LWP :: UserAgent。