root/trunk/plagger/lib/Plagger/Feed.pm

Revision 2 (checked in by miyagawa, 15 years ago)

import Plagger

  • Property svn:keywords set to Id Revision
Line 
1 package Plagger::Feed;
2 use strict;
3
4 use base qw( Class::Accessor::Fast );
5 __PACKAGE__->mk_accessors(qw( title link image description language webmaster tags stash ));
6
7 sub new {
8     my($class, $feed) = @_;
9     bless {
10         title => $feed->{title},
11         link  => $feed->{link},
12         image => $feed->{image},
13         description => $feed->{description},
14         language  => $feed->{language},
15         webmaster => $feed->{webmaster},
16         stash => {},
17         tags  => [],
18         entries => [],
19     }, $class;
20 }
21
22 sub add_entry {
23     my($self, $entry) = @_;
24     push @{ $self->{entries} }, $entry;
25 }
26
27 sub entries {
28     my $self = shift;
29     wantarray ? @{ $self->{entries} } : $self->{entries};
30 }
31
32 1;
Note: See TracBrowser for help on using the browser.