Permalink
Browse files

Added an image() method to Feed objects.

Does something useful for RSS feeds; not for Atom feeds currently.
  • Loading branch information...
1 parent fe6cfa8 commit f25126415aec1e2270c3c366e5be5cdd3a548321 @davorg committed Jul 10, 2012
Showing with 11 additions and 2 deletions.
  1. +1 −0 lib/XML/Feed.pm
  2. +3 −2 lib/XML/Feed/Format/Atom.pm
  3. +7 −0 lib/XML/Feed/Format/RSS.pm
View
1 lib/XML/Feed.pm
@@ -163,6 +163,7 @@ sub add_entry;
sub entries;
sub as_xml;
sub id;
+sub image;
sub tagline { shift->description(@_) }
sub items { $_[0]->entries }
View
5 lib/XML/Feed/Format/Atom.pm
@@ -113,8 +113,9 @@ sub author {
}
}
-
-
+sub image {
+ return;
+}
sub modified {
my $feed = shift;
View
7 lib/XML/Feed/Format/RSS.pm
@@ -162,6 +162,13 @@ sub modified {
}
}
+sub image {
+ my $self = shift;
+ my $rss = $self->{rss};
+
+ return @_ ? $rss->image(@_) : $rss->image('url');
+}
+
sub entries {
my $rss = $_[0]->{rss};
my @entries;

0 comments on commit f251264

Please sign in to comment.