我正在尝试使用 AnyEvent::Twitter::Stream 模块,并且我想引用一个列出我想要关注的 Twitter uid 的文件。我可以将 uids 放在代码本身中,它的工作原理如下:
my $done = AnyEvent->condvar;
my $nt_filter = AnyEvent::Twitter::Stream->new(
username => $cf{account},
password => $cf{password},
method => 'filter',
follow => '15855509,14760150,18598536',
on_tweet => sub {
#some code.....
},
on_error => sub {
my $error = shift;
debug "ERROR: $error";
},
timeout => 45,
);
$done->recv;
但是当我尝试使用这样的文件做同样的事情时:
my $done = AnyEvent->condvar;
my $nt_filter = AnyEvent::Twitter::Stream->new(
open UID_FILE, "/tmp/uids" or die $!;
my @uid_line = <UID_FILE>;
username => $cf{account},
password => $cf{password},
method => 'filter',
follow => @uid_file,
on_tweet => sub {
#some code....
},
on_error => sub {
my $error = shift;
debug "ERROR: $error";
},
timeout => 45,
);
$done->recv;
它失败。uids 文件有以下内容:
'15855509,14760150,18598536'
我从 Twitter 收到 406 错误,表明格式不正确。我猜引号不正确?