Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.

X Report information
Id: 33881
Status: resolved
Left: 0 min
Priority: 0/0
Queue: XML-Feed

Owner: Nobody
Requestors: PMISON <PMISON [...] cpan.org>
Cc: perl [...] songtwo.demon.co.uk
AdminCc:

Severity: Normal
Broken in: 0.12
Fixed in: (no value)

X Attachments
xml_feed_atom_accessors.diff




X History Display mode: Brief headersFull headers
#   Fri Mar 07 11:46:56 2008 PMISON - Ticket created  
CC: perl[...]songtwo.demon.co.uk
Subject: Additional accessors needed for valid Atom feeds
[text/plain 234b]
XML::Feed's Atom feeds don't validate, in part because there's no way to set an id, updated date
or <link rel="self"> entry for a feed, or an updated time for an entry. I've attached a diff that
adds these accessors and tests them.

Subject: xml_feed_atom_accessors.diff

[text/plain 1.9k]
--- XML-Feed-0.12/lib/XML/Feed/Atom.pm 2008-03-06 20:37:11.000000000 +0000
+++ XML-Feed/lib/XML/Feed/Atom.pm 2008-03-06 20:40:51.000000000 +0000
@@ -42,6 +42,9 @@
sub copyright { shift->{atom}->copyright(@_) }
sub language { shift->{atom}->language(@_) }
sub generator { shift->{atom}->generator(@_) }
+sub id { shift->{atom}->id(@_) }
+sub updated { shift->{atom}->updated(@_) }
+sub add_link { shift->{atom}->add_link(@_) }

sub author {
my $feed = shift;
@@ -96,6 +99,9 @@
}

sub title { shift->{entry}->title(@_) }
+sub source { shift->{entry}->source(@_) }
+sub updated { shift->{entry}->updated(@_) }
+
sub link {
my $entry = shift;
if (@_) {
diff -ru XML-Feed-0.12/t/07-atom10-create.t XML-Feed/t/07-atom10-create.t
--- XML-Feed-0.12/t/07-atom10-create.t 2006-08-14 06:27:10.000000000 +0100
+++ XML-Feed/t/07-atom10-create.t 2008-03-06 20:42:03.000000000 +0000
@@ -1,20 +1,27 @@
use strict;
use Test::More;

-plan 'no_plan';
+plan tests => 17;

use XML::Feed;
+use DateTime;
+
+my $now = DateTime->now();

my $feed = XML::Feed->new('Atom');
$feed->title("foo");
$feed->description("Atom 1.0 feed");
$feed->link("http://example.org/");
+$feed->id("tag:cpan.org;xml-feed-atom");
+$feed->updated($now);

my $entry = XML::Feed::Entry->new('Atom');
$entry->title("1st Entry");
$entry->link("http://example.org/");
$entry->category("blah");
$entry->content("<p>Hello world.</p>");
+$entry->id("tag:cpan.org;xml-feed-atom-entry");
+$entry->updated($now);

$feed->add_entry($entry);

@@ -29,6 +36,8 @@
is $feed->title, "foo";
is $feed->description, "Atom 1.0 feed";
is $feed->link, "http://example.org/";
+is $feed->id, "tag:cpan.org;xml-feed-atom";
+is $feed->updated, $now;

my @entries = $feed->entries;
is @entries, 1;
@@ -40,5 +49,7 @@
is $entry->content->type, 'text/html';
like $entry->content->body, qr!\s*<p>Hello world.</p>\s*!s;

+is $entry->id, "tag:cpan.org;xml-feed-atom-entry";
+is $entry->updated, $now;



#   Thu Oct 16 14:54:07 2008 SIMONW - Correspondence added  
[text/plain 22b]
Should be fixed in 0.2
#   Thu Oct 16 14:54:11 2008 RT_System - Status changed from 'new' to 'open'  
#   Thu Oct 16 14:54:33 2008 SIMONW - Status changed from 'open' to 'resolved'