Skip Menu |

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

Report information
The Basics
Id: 67349
Status: resolved
Priority: 0/
Queue: XML-Feed

People
Owner: DAVECROSS [...] cpan.org
Requestors: KAPPA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.43
Fixed in: (no value)



Subject: Add support for <guid isPermaLink> in RSS 2.0 feeds
RSS 2.0 entries may contain <guid> elements with isPermaLink attribute. They get converted to 'permaLink' instead of 'guid'. Take this into account when returning links not only when setting. See included test.
Subject: rss20-perma.patch
Index: t/18-rss2-permalinks.t =================================================================== --- t/18-rss2-permalinks.t (revision 0) +++ t/18-rss2-permalinks.t (revision 0) @@ -0,0 +1,13 @@ +# $Id$ + +use strict; +use Test::More tests => 2; +use XML::Feed; + +my $feed; +my $file = 't/samples/rss20-p.xml'; +$feed = XML::Feed->parse($file); +isa_ok($feed, 'XML::Feed::Format::RSS'); + +my $entry = ($feed->entries)[0]; +is($entry->link, 'http://creograf.ru/post/regexp-js'); Index: t/samples/rss20-p.xml =================================================================== --- t/samples/rss20-p.xml (revision 0) +++ t/samples/rss20-p.xml (revision 0) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule"> + +<channel> +<title>Some title</title> +<link>http://creograf.ru/blog/4programmer</link> +<description>Some desc</description> +<language>ru-ru</language> +<pubDate>Sun, 3 Apr 2011 05:42:15 +0300</pubDate> +<lastBuildDate>Sun, 3 Apr 2011 05:42:15 +0300</lastBuildDate> + +<item> +<title>Some entry</title> +<description></description> +<guid isPermaLink="true">http://creograf.ru/post/regexp-js</guid> +<pubDate>Sun, 3 Apr 2011 05:42:12 +0300</pubDate> +</item> + +</channel> +</rss> Index: lib/XML/Feed/Format/RSS.pm =================================================================== --- lib/XML/Feed/Format/RSS.pm (revision 160) +++ lib/XML/Feed/Format/RSS.pm (working copy) @@ -190,7 +190,7 @@ ## For RSS 2.0 output from XML::RSS. Sigh. $entry->{entry}{permaLink} = $_[0]; } else { - $entry->{entry}{link} || $entry->{entry}{guid}; + $entry->{entry}{link} || $entry->{entry}{permaLink} || $entry->{entry}{guid}; } }
This patch has been applied to v0.46 which will be on CPAN later today.