line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perlanet::Feed; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
48
|
use strict; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
216
|
|
4
|
7
|
|
|
7
|
|
38
|
use warnings; |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
236
|
|
5
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
45
|
use Moose; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
55
|
|
7
|
7
|
|
|
7
|
|
37266
|
use XML::Feed; |
|
7
|
|
|
|
|
879636
|
|
|
7
|
|
|
|
|
1673
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Perlanet::Feed - represents a feed |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'title' => ( |
16
|
|
|
|
|
|
|
isa => 'Str', |
17
|
|
|
|
|
|
|
is => 'rw', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'url' => ( |
21
|
|
|
|
|
|
|
isa => 'Str', |
22
|
|
|
|
|
|
|
is => 'rw', |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'web' => ( |
26
|
|
|
|
|
|
|
isa => 'Str', |
27
|
|
|
|
|
|
|
is => 'rw', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'format' => ( |
31
|
|
|
|
|
|
|
is => 'rw', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has 'description' => ( |
35
|
|
|
|
|
|
|
is => 'rw', |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'author' => ( |
39
|
|
|
|
|
|
|
is => 'rw', |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'email' => ( |
43
|
|
|
|
|
|
|
is => 'rw', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has '_xml_feed' => ( |
47
|
|
|
|
|
|
|
isa => 'XML::Feed', |
48
|
|
|
|
|
|
|
is => 'rw', |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has 'id' => ( |
52
|
|
|
|
|
|
|
is => 'rw', |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has 'self_link' => ( |
56
|
|
|
|
|
|
|
is => 'rw', |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has 'modified' => ( |
60
|
|
|
|
|
|
|
is => 'rw', |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has 'entries' => ( |
64
|
|
|
|
|
|
|
isa => 'ArrayRef', |
65
|
|
|
|
|
|
|
is => 'rw', |
66
|
|
|
|
|
|
|
default => sub { [] }, |
67
|
|
|
|
|
|
|
traits => [ 'Array' ], |
68
|
|
|
|
|
|
|
handles => { |
69
|
|
|
|
|
|
|
add_entry => 'push', |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 as_xml |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns a string containing the XML for this feed and all its entries |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub as_xml { |
82
|
0
|
|
|
0
|
1
|
|
my ($self, $format) = @_; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $feed = XML::Feed->new($format); |
85
|
0
|
|
|
|
|
|
$feed->title($self->title); |
86
|
0
|
|
|
|
|
|
$feed->link($self->url); |
87
|
0
|
|
|
|
|
|
$feed->description($self->description); |
88
|
0
|
|
|
|
|
|
$feed->author($self->author); |
89
|
0
|
0
|
|
|
|
|
if ($format eq 'Atom') { |
90
|
0
|
|
|
|
|
|
$feed->{atom}->author->email($self->email); |
91
|
|
|
|
|
|
|
} |
92
|
0
|
|
|
|
|
|
$feed->modified($self->modified); |
93
|
0
|
|
|
|
|
|
$feed->self_link($self->self_link); |
94
|
0
|
|
|
|
|
|
$feed->id($self->id); |
95
|
0
|
|
|
|
|
|
$feed->add_entry($_->_entry) for @{ $self->entries }; |
|
0
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return $feed->as_xml; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
7
|
|
|
7
|
|
71
|
no Moose; |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
71
|
|
100
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
101
|
|
|
|
|
|
|
1; |