Skip to content

Commit

Permalink
Represent entries as Perlanet::Entry objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Charles authored and davorg committed Dec 13, 2009
1 parent 21688c9 commit 1e79593
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/Perlanet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use HTML::Tidy;
use HTML::Scrubber;
use TryCatch;
use Perlanet::Feed;
use Perlanet::Entry;

use vars qw{$VERSION};

Expand Down Expand Up @@ -327,7 +328,13 @@ sub select_entries
}

push @feed_entries,
map { $_->title($feed->title . ': ' . $_->title); $_ } @entries;
map {
$_->title($feed->title . ': ' . $_->title);
Perlanet::Entry->new(
_entry => $_,
feed => $feed
);
} @entries;
}

return @feed_entries;
Expand Down Expand Up @@ -378,7 +385,7 @@ sub build_feed
$f->self_link($self_url);
$f->id($self_url);

$f->add_entry($_) for @entries;
$f->add_entry($_->_entry) for @entries;
return $f;
}

Expand Down
19 changes: 19 additions & 0 deletions lib/Perlanet/Entry.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package Perlanet::Entry;
use Moose;

has '_entry' => (
isa => 'XML::Feed::Entry',
is => 'ro',
required => 1,
handles => [qw( title issued body summary content modified )]
);

has 'feed' => (
isa => 'Perlanet::Feed',
is => 'ro',
required => 1
);

no Moose;
__PACKAGE__->meta->make_immutable;
1;

0 comments on commit 1e79593

Please sign in to comment.