1 |
package Frey::Feed::Sponge; |
2 |
use Moose; |
3 |
|
4 |
extends 'Frey::Feed'; |
5 |
with 'Frey::Web'; |
6 |
|
7 |
has uri => ( |
8 |
is => 'rw', |
9 |
isa => 'Uri', coerce => 1, |
10 |
required => 1, |
11 |
default => 'http://blog.rot13.org/index.xml', |
12 |
); |
13 |
|
14 |
sub as_sponge { |
15 |
my ($self) = @_; |
16 |
|
17 |
my @rows; |
18 |
|
19 |
foreach my $entry ( $self->entries ) { |
20 |
my @row; |
21 |
push @row, $entry->$_ foreach ( qw/pubDate title link description/ ); |
22 |
push @rows, [ @row ]; |
23 |
} |
24 |
|
25 |
return { |
26 |
table => 'feed_items', |
27 |
rows => \@rows, |
28 |
NAME => [ qw/date title link description/ ], |
29 |
}; |
30 |
} |
31 |
|
32 |
__PACKAGE__->meta->make_immutable; |
33 |
no Moose; |
34 |
|
35 |
1; |