Subject: | Empty item in feed causes XML::FeedPP to stop processing |
There is a malformed feed with an empty item in the channel. This
causes XML::FeedPP to throw an error with initiailizing a new object:
my $feed = XML::FeedPP->new($badFeed);
Can't bless non-reference value at /usr/share/perl5/XML/FeedPP.pm line
2177.
The real error is in sub init_feed:
foreach my $item ( @{ $self->{rss}->{channel}->{item} } ) {
$self->item_class->ref_bless($item);
}
since $item is not a reference.
It would be nice if they could either be silently skipped ala:
ITEM: foreach my $item ( @{ $self->{rss}->{channel}->{item} } ) {
next ITEM unless ref($item); ##Oversimplistic solution.
$self->item_class->ref_bless($item);
}
or maybe warn and skip. I'm attaching the current output of the feed in
question for reference, since it may change.
Subject: | feed.xml |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0" xmlns:content="http://www.germany-usa.com/">
<channel>
<title>GERMANY-USA Career Center</title>
<copyright>Copyright (c) 2008 Germany-USA Career Center. All rights reserved.</copyright>
<link>http://www.germany-usa.com/pages/applicants.php</link>
<description>Jobs for bilingual MBAs, financial analysts, attorneys and legal assistants, manufacturing and software engineers, (technical) sales reps, executive administrators, customer service representatives, quality assurance specialists... Make sure we have your resume on file! Wir sprechen auch Deutsch.</description>
<language>en-us,de</language>
<lastBuildDate>Wed, 04 Apr 2007 16:46:24 GMT</lastBuildDate>
<ttl>60</ttl>
<image>
<title>New Jobs</title>
<width>142</width>
<height>18</height>
<link>http://www.germany-usa.com</link>
<url>http://www.germany-usa.com/images/GUCC_120x54.jpg</url>
</image><item>
<title>Customer Service Rep/Logistics Support</title>
<link>http://www.germany-usa.com/jobs/218</link>
<guid isPermaLink="false"></guid>
<pubDate>Thu, 17 May 2012 15:02:00 GMT</pubDate>
<description>Customer Service/Call Center Unterhaching, Bayern, Germany (Full Time)</description>
</item>
<item>
</item>
<item>
<title>CNC Programmierer (m/w), Numroto-Erfahrung</title>
<link>http://www.germany-usa.com/jobs/216</link>
<guid isPermaLink="false"></guid>
<pubDate>Thu, 19 Apr 2012 22:25:00 GMT</pubDate>
<description>Manufacturing/Production nahe Orlando, FL U.S.A. (Full Time)</description>
</item>
<item>
<title>Quote/Purchasing Agent</title>
<link>http://www.germany-usa.com/jobs/215</link>
<guid isPermaLink="false"></guid>
<pubDate>Thu, 19 Apr 2012 16:21:00 GMT</pubDate>
<description>Import/Export Germany, Germany (Work at Home)</description>
</item>
<item>
<title>Territory Manager - The Netherlands</title>
<link>http://www.germany-usa.com/jobs/213</link>
<guid isPermaLink="false"></guid>
<pubDate>Mon, 12 Mar 2012 23:14:00 GMT</pubDate>
<description>Healthcare Cologne, Germany (Full Time)</description>
</item>
</channel>
</rss>