$feed->{numposts}=0 unless defined $feed->{numposts};
$feed->{newposts}=0 unless defined $feed->{newposts};
$feed->{message}="new feed" unless defined $feed->{message};
+ $feed->{error}=0 unless defined $feed->{error};
$feed->{tags}=[];
while (@_) {
my $key=shift;
}
return "<a href=\"".$feed->{url}."\">".$feed->{name}."</a>: ".
- "<i>".$feed->{message}."</i> (".$feed->{numposts}." posts".
+ ($feed->{error} ? "<em>" : "").$feed->{message}.
+ ($feed->{error} ? "</em>" : "").
+ " (".$feed->{numposts}." posts".
($feed->{newposts} ? "; ".$feed->{newposts}." new" : "").
")";
} # }}}
my @urls=XML::Feed->find_feeds($feed->{url});
if (! @urls) {
$feed->{message}="could not find feed at ".$feed->{feedurl};
+ $feed->{error}=1;
debug($feed->{message});
next;
}
my $f=eval{XML::Feed->parse(URI->new($feed->{feedurl}))};
if ($@) {
$feed->{message}="feed crashed XML::Feed! $@";
+ $feed->{error}=1;
debug($feed->{message});
next;
}
if (! $f) {
$feed->{message}=XML::Feed->errstr;
+ $feed->{error}=1;
debug($feed->{message});
next;
}
$feed->{message}="processed ok at ".
displaytime($feed->{lastupdate});
+ $feed->{error}=0;
}
# TODO: expiry