Skip Menu |

This queue is for tickets about the AnyEvent-Feed CPAN distribution.

Report information
The Basics
Id: 60347
Status: resolved
Priority: 0/
Queue: AnyEvent-Feed

People
Owner: Nobody in particular
Requestors: david [...] dklb.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.2
Fixed in: (no value)



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.
On Sat Aug 14 16:37:44 2010, david@dklb.org wrote: Show quoted text
> 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";
The problem is, that @_ is the subroutines parameter. What was originally meant (in the Synopsis) is @$_. Also on second sight, XML::Feed::Entry doesn't have a 'url' method. I fixed the synopsis in my git repository. Thanks for the report! Greetings, Robin