line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Feed::Source::Page2RSS; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
54080
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
69
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
12
|
use Carp; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
170
|
|
7
|
2
|
|
|
2
|
|
2132
|
use URI; |
|
2
|
|
|
|
|
23858
|
|
|
2
|
|
|
|
|
88
|
|
8
|
|
|
|
|
|
|
use constant { |
9
|
2
|
|
|
|
|
1166
|
RSS => "http://page2rss.com/page/rss", |
10
|
|
|
|
|
|
|
ATOM => "http://page2rss.com/page/atom", |
11
|
2
|
|
|
2
|
|
26
|
}; |
|
2
|
|
|
|
|
3
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Feed::Source::Page2RSS - Creation of a Atom/RSS feed with the Page2RSS service |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Version 0.01 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Page2RSS create a Atom/RSS feed to monitor a webpage. This module help you to |
28
|
|
|
|
|
|
|
create these feeds. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use Feed::Source::Page2RSS; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $feed = Feed::Source::Page2RSS->new( url => "http://www.google.com", feed_type => "rss" ); |
33
|
|
|
|
|
|
|
my $feed_url = $feed->url_feed(); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
or |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $feed = Feed::Source::Page2RSS->new( url => "http://www.google.com" ); |
38
|
|
|
|
|
|
|
my $atom = $feed->atom_feed(); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
is equivalent to |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $feed = Feed::Source::Page2RSS->new( url => "http://www.google.com" ); |
43
|
|
|
|
|
|
|
$feed->feed_type('atom'); |
44
|
|
|
|
|
|
|
my $atom = $feed->url_feed(); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
or |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $feed = Feed::Source::Page2RSS->new( url => "http://www.google.com" ); |
49
|
|
|
|
|
|
|
my $rss = $feed->rss_feed(); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
is equivalent to |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $feed = Feed::Source::Page2RSS->new( url => "http://www.google.com" ); |
54
|
|
|
|
|
|
|
$feed->feed_type('rss'); |
55
|
|
|
|
|
|
|
my $rss = $feed->url_feed(); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 FUNCTIONS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 new |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Constructor of the Feed::Source::Page2RSS object. You can spcecify the |
62
|
|
|
|
|
|
|
following options : |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=over 4 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item url |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
URL to monitor |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item feed_type |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Feed type of the returned URL. Possible values are RSS and Atom. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=back |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub new { |
79
|
3
|
|
|
3
|
1
|
2367
|
my ($class, %args) = @_; |
80
|
3
|
|
|
|
|
5
|
my $self; |
81
|
3
|
100
|
|
|
|
15
|
$self->{params}{url} = $args{url} if exists $args{url}; |
82
|
3
|
|
50
|
|
|
96
|
$self->{feed_type} = uc $args{feed_type} || "RSS"; |
83
|
3
|
|
|
|
|
10
|
bless $self, $class; |
84
|
3
|
|
|
|
|
11
|
$self; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 feed_type |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Adjust the feed type. Possible value are RSS and Atom. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub feed_type { |
94
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
95
|
0
|
0
|
|
|
|
0
|
$self->{feed_type} = uc shift if @_; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 url_feed |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Return the URL feed. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub url_feed { |
105
|
2
|
|
|
2
|
1
|
9
|
my $self = shift; |
106
|
2
|
100
|
|
|
|
10
|
if (exists $self->{params}{url}) { |
107
|
1
|
|
|
|
|
3
|
my $uri; |
108
|
1
|
50
|
|
|
|
3
|
if ($self->{feed_type} eq "RSS") { |
109
|
1
|
|
|
|
|
9
|
$uri = URI->new(RSS); |
110
|
|
|
|
|
|
|
} else { |
111
|
0
|
|
|
|
|
0
|
$uri = URI->new(ATOM) |
112
|
|
|
|
|
|
|
} |
113
|
1
|
|
|
|
|
10863
|
$uri->query_form( $self->{params} ); |
114
|
1
|
|
|
|
|
279
|
return $uri->as_string(); |
115
|
|
|
|
|
|
|
} else { |
116
|
1
|
|
|
|
|
152
|
croak "You must specify an URL to monitor"; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 atom_feed |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Return the Atom URL feed. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub atom_feed { |
128
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
129
|
0
|
0
|
|
|
|
|
if (exists $self->{params}{url}) { |
130
|
0
|
|
|
|
|
|
my $uri = URI->new(ATOM); |
131
|
0
|
|
|
|
|
|
$uri->query_form( $self->{params} ); |
132
|
0
|
|
|
|
|
|
return $uri->as_string(); |
133
|
|
|
|
|
|
|
} else { |
134
|
0
|
|
|
|
|
|
croak "You must specify an URL to monitor"; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 rss_feed |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Return the RSS URL feed. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub rss_feed { |
146
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
147
|
0
|
0
|
|
|
|
|
if (exists $self->{params}{url}) { |
148
|
0
|
|
|
|
|
|
my $uri = URI->new(RSS); |
149
|
0
|
|
|
|
|
|
$uri->query_form( $self->{params} ); |
150
|
0
|
|
|
|
|
|
return $uri->as_string(); |
151
|
|
|
|
|
|
|
} else { |
152
|
0
|
|
|
|
|
|
croak "You must specify an URL to monitor"; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 AUTHOR |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Emmanuel Di Pretoro, C<< <> >> |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 BUGS |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
165
|
|
|
|
|
|
|
C, or through the web interface at |
166
|
|
|
|
|
|
|
L. |
167
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
168
|
|
|
|
|
|
|
your bug as I make changes. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 SUPPORT |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
perldoc Feed::Source::Page2RSS |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
You can also look for information at: |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=over 4 |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * CPAN Ratings |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * Search CPAN |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 SEE ALSO |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Page2RSS L |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Copyright 2006 Emmanuel Di Pretoro, all rights reserved. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
207
|
|
|
|
|
|
|
under the same terms as Perl itself. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
1; # End of Feed::Source::Page2RSS |