Add enclosure code.
Simon Wistow [Mon, 24 Nov 2008 00:47:26 +0000 (00:47 +0000)]
lib/XML/Feed/Format/Atom.pm
lib/XML/Feed/Format/RSS.pm

index 4846947..071e9f7 100644 (file)
@@ -287,4 +287,16 @@ sub long {
     }
 }
 
+
+sub add_enclosure {
+    my($entry, $enclosure) = @_;
+    my $link = XML::Atom::Link->new;
+    $link->rel('enclosure');
+    $link->type($enclosure->type);
+    $link->href($enclosure->url);
+    $link->length($enclosure->length);
+    $entry->{entry}->add_link($link);
+};
+
+
 1;
index b9f29f8..c5c11b7 100644 (file)
@@ -324,5 +324,15 @@ sub long {
     }
 }
 
+sub add_enclosure {
+    my($entry, $enclosure) = @_;
+    $entry->{entry}->{enclosure} = XML::RSS::LibXML::MagicElement->new(
+        attributes => {
+                 url    => $enclosure->{url},
+                 type   => $enclosure->{type},
+                 length => $enclosure->{length}
+        },
+    );
+}
 
 1;