Make feed validate
Simon Wistow [Wed, 22 Oct 2008 19:10:08 +0000 (19:10 +0000)]
lib/XML/Feed.pm
lib/XML/Feed/RSS.pm

index 59c6636..4dee35b 100644 (file)
@@ -133,6 +133,7 @@ sub generator;
 sub add_entry;
 sub entries;
 sub as_xml;
+sub id;
 
 sub tagline { shift->description(@_) }
 sub items   { $_[0]->entries     }
@@ -192,6 +193,10 @@ I<DateTime> objects, which it then returns to the caller.
 
 Creates a new empty I<XML::Feed> object using the format I<$format>.
 
+    $feed = XML::Feed->new('Atom');
+    $feed = XML::Feed->new('RSS');
+    $feed = XML::Feed->new('RSS', version => '0.91');
+
 =head2 XML::Feed->parse($stream)
 
 =head2 XML::Feed->parse($stream, $format)
index 97937e1..d33397e 100644 (file)
@@ -15,11 +15,7 @@ sub init_empty {
     eval "use $PREFERRED_PARSER"; die $@ if $@;
     $feed->{rss} = $PREFERRED_PARSER->new(%args);
     $feed->{rss}->add_module(prefix => "content", uri => 'http://purl.org/rss/1.0/modules/content/');
-    if ($args{'version'} >= 2.0) {
-        $feed->{rss}->add_module(prefix => "dcterms", uri => 'http://purl.org/dc/terms/');    
-    } else {
-        $feed->{rss}->add_module(prefix => "dcterms", uri => 'http://purl.org/rss/1.0/modules/dcterms/');
-    }
+    $feed->{rss}->add_module(prefix => "dcterms", uri => 'http://purl.org/dc/terms/');    
     $feed;
 }
 
@@ -40,6 +36,9 @@ sub title       { shift->{rss}->channel('title', @_) }
 sub link        { shift->{rss}->channel('link', @_) }
 sub description { shift->{rss}->channel('description', @_) }
 
+# This doesn't exist in RSS
+sub id          { }
+
 ## This is RSS 2.0 only--what's the equivalent in RSS 1.0?
 sub copyright   { shift->{rss}->channel('copyright', @_) }