summaryrefslogtreecommitdiff
path: root/lib/Feed/HelperRole/FeedEntry.pm
blob: 3abe2e13f7c5ba5d9235391825faa5b596b71683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package Feed::HelperRole::FeedEntry; 
use Moose::Role;
use 5.012;
use namespace::autoclean;
 
requires 'content','summary','id','link','modified','issued';
 
sub unified_id {
    my ($self) = @_;
 
    return $self->id // $self->link;
}
 
sub unified_date {
    my ($self) = @_;
 
    return $self->modified // $self->issued;
}
 
sub unified_content {
    my ($self) = @_;
 
    my $c = $self->content;
    return $c if $c->body;
    return $self->summary;
}
 
1;