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