Subject: | unblessed references from $new_entries |
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
Linux hostname 2.6.31.12-rt21-1-686 #1 SMP PREEMPT RT Fri Feb 19
15:39:59 UTC 2010 i686 GNU/Linux
#!/usr/bin/perl
#use AnyEvent;
use AnyEvent (); BEGIN { AnyEvent::common_sense }
use AnyEvent::Feed;
use AnyEvent::Strict; # remove for production!
my $c = AnyEvent->condvar;
my $seconds = 60;
my $feed_reader =
AnyEvent::Feed->new (
url => 'http://rss.slashdot.org/Slashdot/slashdot',
interval => $seconds,
on_fetch => sub {
my ($feed_reader, $new_entries, $feed, $error) = @_;
if (defined $error) {
warn "ERROR: $error\n";
return;
}
for (@$new_entries) {
my ($hash, $entry) = @_;
# $hash a unique hash describing the $entry
# $entry is the XML::Feed::Entry object of the new entries
# since the last fetch.
print $entry->title . " " . $entry->url . "\n";
}
}
);
$c->wait;
# kunwon1@hostname:~/newsbot$ perl newstest.pl
# EV: error in callback (ignoring): Can't call method "title" on
unblessed reference at newstest.pl line 31.