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: 24729
Status: resolved
Left: 0 min
Priority: 0/0
Queue: XML-Feed

Owner: Nobody
Requestors: CLACO <claco [...] cpan.org>
Cc:
AdminCc:

Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)




X History Display mode: Brief headersFull headers
#   Thu Feb 01 17:01:32 2007 CLACO - Ticket created  
Subject: Allow Version Specification
[text/plain 251b]
Since XML::Feed is an abstraction layer, if you be nice if it didn't
assume that I always wanted Atom 1.0 instead of 0.3, and RSS 2.0 instead
of 1.0.

It would be nice if new() took a version param and passwed that along to
the actual feed generators.
#   Fri Feb 02 14:21:53 2007 CLACO - Correspondence added  
From: CLACO[...]cpan.org
[text/plain 488b]
On Thu Feb 01 17:01:32 2007, CLACO wrote:
> Since XML::Feed is an abstraction layer, if you be nice if it didn't
> assume that I always wanted Atom 1.0 instead of 0.3, and RSS 2.0 instead
> of 1.0.
>
> It would be nice if new() took a version param and passwed that along to
> the actual feed generators.

Here's a quick set of patches that forward any extra new() args into
init_empty, and ultimately, the XML::Atom and XML::RSS
classes.....including an alternate version if desired...


[text/x-perl 381b]
--- Atom.pm.orig Mon Aug 14 01:31:28 2006
+++ Atom.pm Fri Feb 02 13:55:20 2007
@@ -10,8 +10,10 @@
use DateTime::Format::W3CDTF;

sub init_empty {
- my $feed = shift;
- $feed->{atom} = XML::Atom::Feed->new(Version => 1.0);
+ my ($feed, %args) = @_;
+ $args{'Version'} ||= '1.0';
+
+ $feed->{atom} = XML::Atom::Feed->new(%args);
$feed;
}



[text/x-perl 635b]
--- RSS.pm.orig Sat Apr 22 01:13:56 2006
+++ RSS.pm Fri Feb 02 14:12:15 2007
@@ -10,9 +10,10 @@
our $PREFERRED_PARSER = "XML::RSS";

sub init_empty {
- my $feed = shift;
+ my ($feed, %args) = @_;
+ $args{'version'} ||= '2.0';
eval "use $PREFERRED_PARSER"; die $@ if $@;
- $feed->{rss} = $PREFERRED_PARSER->new( version => '2.0' );
+ $feed->{rss} = $PREFERRED_PARSER->new(%args);
$feed->{rss}->add_module(prefix => "content", uri => 'http://purl.org/rss/1.0/modules/content/');
$feed->{rss}->add_module(prefix => "dcterms", uri => 'http://purl.org/rss/1.0/modules/dcterms/');
$feed;


[text/x-perl 582b]
--- Feed.pm.orig Mon Aug 14 01:31:28 2006
+++ Feed.pm Fri Feb 02 13:42:13 2007
@@ -12,13 +12,12 @@

sub new {
my $class = shift;
- my($format) = @_;
- $format ||= 'Atom';
+ my $format = shift || 'Atom';
my $format_class = 'XML::Feed::' . $format;
eval "use $format_class";
Carp::croak("Unsupported format $format: $@") if $@;
my $feed = bless {}, join('::', __PACKAGE__, $format);
- $feed->init_empty or return $class->error($feed->errstr);
+ $feed->init_empty(@_) or return $class->error($feed->errstr);
$feed;
}


#   Thu Oct 16 14:52:57 2008 SIMONW - Correspondence added  
[text/plain 22b]
Should be fixed in 0.2
#   Thu Oct 16 14:52:59 2008 RT_System - Status changed from 'new' to 'open'  
#   Thu Oct 16 14:53:00 2008 SIMONW - Status changed from 'open' to 'resolved'