Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: claco [...] cpan.org
Cc:
AdminCc:

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



Subject: Allow Version Specification
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.
From: CLACO [...] cpan.org
On Thu Feb 01 17:01:32 2007, CLACO wrote: Show quoted text
> 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...
--- 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; }
--- 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;
--- 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; }
Should be fixed in 0.2