Debian Codegraph @

README

raw
1 NAME
2 POE::Component::RSSAggregator - Watch Muliple RSS Feeds for New
3 Headlines
4
5 VERSION
6 Version 1.11
7
8 SYNOPSIS
9 #!/usr/bin/perl
10 use strict;
11 use warnings;
12 use POE;
13 use POE::Component::RSSAggregator;
14
15 my @feeds = (
16 { url => "http://www.jbisbee.com/rdf/",
17 name => "jbisbee",
18 delay => 10,
19 },
20 { url => "http://lwn.net/headlines/rss",
21 name => "lwn",
22 delay => 300,
23 },
24 );
25
26 POE::Session->create(
27 inline_states => {
28 _start => \&init_session,
29 handle_feed => \&handle_feed,
30 },
31 );
32
33 $poe_kernel->run();
34
35 sub init_session {
36 my ( $kernel, $heap, $session ) = @_[ KERNEL, HEAP, SESSION ];
37 $heap->{rssagg} = POE::Component::RSSAggregator->new(
38 alias => 'rssagg',
39 debug => 1,
40 callback => $session->postback("handle_feed"),
41 tmpdir => '/tmp', # optional caching
42 );
43 $kernel->post( 'rssagg', 'add_feed', $_ ) for @feeds;
44 }
45
46 sub handle_feed {
47 my ( $kernel, $feed ) = ( $_[KERNEL], $_[ARG1]->[0] );
48 for my $headline ( $feed->late_breaking_news ) {
49
50 # do stuff with the XML::RSS::Headline object
51 print $headline->headline . "\n";
52 }
53 }
54
55 CONSTRUCTORS
56 POE::Component::RSSAggregator->new( %hash );
57 Create a new instace of PoCo::RSSAggregator.
58
59 * alias
60
61 POE alias to use for your instance of PoCo::RSSAggregator.
62
63 * debug
64
65 Boolean value to turn on verbose output. (debug is also passed to
66 XML::RSS::Feed instances to turn on verbose output as well)
67
68 * tmpdir
69
70 The tmpdir argument is passed on to XML::RSS::Feed as the directory
71 to cache RSS between fetches (and instances).
72
73 * http_alias
74
75 Optional. Alias of an existing PoCoCl::HTTP.
76
77 * follow_redirects
78
79 Optional. Only if you don't have an exiting PoCoCl::HTTP. Argument
80 is passed to PoCoCl::HTTP to tell it the follow redirect level.
81 (Defaults to 2)
82
83 METHODS
84 $rssagg->feed_list
85 Returns the current feeds as an array or array_ref.
86
87 $rssagg->feeds
88 Returns a hash ref of feeds with the key being the feeds name. The hash
89 reference you that belongs to the key is passed to
90 XML::RSS::Feed->new($hash_ref). ( see XML::RSS::Feed )
91
92 $rssagg->feed( $feed_name )
93 Accessor to access a the XML::RSS::Feed object via a feed's name.
94
95 $rssagg->add_feed( $hash_ref )
96 The hash reference you pass in to add_feed is passed to
97 XML::RSS::Feed->new($hash_ref). ( see XML::RSS::Feed )
98
99 $rssagg->remove_feed( $feed_name )
100 Pass in the name of the feed you want to remove.
101
102 $rssagg->pause_feed( $feed_name )
103 Pass in the name of the feed you want to pause.
104
105 $rssagg->resume_feed( $feed_name )
106 Pass in the name of the feed you want to resume (that you previously
107 paused).
108
109 $rssagg->shutdown
110 Shutdown the instance of PoCo::RSSAggregator.
111
112 AUTHOR
113 Jeff Bisbee, "<jbisbee at cpan.org>"
114
115 BUGS
116 Please report any bugs or feature requests to
117 "bug-poe-component-rssaggregator at rt.cpan.org", or through the web
118 interface at
119 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-RSSAggrega
120 tor>. I will be notified, and then you'll automatically be notified of
121 progress on your bug as I make changes.
122
123 SUPPORT
124 You can find documentation for this module with the perldoc command.
125
126 perldoc POE::Component::RSSAggregator
127
128 You can also look for information at:
129
130 * AnnoCPAN: Annotated CPAN documentation
131
132 <http://annocpan.org/dist/POE-Component-RSSAggregator>
133
134 * CPAN Ratings
135
136 <http://cpanratings.perl.org/d/POE-Component-RSSAggregator>
137
138 * RT: CPAN's request tracker
139
140 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-RSSAggregato
141 r>
142
143 * Search CPAN
144
145 <http://search.cpan.org/dist/POE-Component-RSSAggregator>
146
147 ACKNOWLEDGEMENTS
148 Special thanks to Rocco Caputo, Martijn van Beers, Sean Burke, Prakash
149 Kailasa and Randal Schwartz for their help, guidance, patience, and bug
150 reports. Guys thanks for actually taking time to use the code and give
151 good, honest feedback.
152
153 COPYRIGHT & LICENSE
154 Copyright 2006 Jeff Bisbee, all rights reserved.
155
156 This program is free software; you can redistribute it and/or modify it
157 under the same terms as Perl itself.
158
159 SEE ALSO
160 XML::RSS::Feed, XML::RSS::Headline, XML::RSS::Headline::PerlJobs,
161 XML::RSS::Headline::Fark
162