NAME

POE::Component::RSSAggregator - Watch Muliple RSS Feeds for New Headlines

SYNOPSIS

    #!/usr/bin/perl
    use strict;
    use warnings;
    use POE;
    use POE::Component::RSSAggregator;

    my @feeds = (
	{ url   => "http://www.jbisbee.com/rdf/",
	  name  => "jbisbee",
	  delay => 10, },
	{ url   => "http://lwn.net/headlines/rss",
	  name  => "lwn",
	  delay => 300 });

    POE::Session->create(
	inline_states => {
	    _start      => \&init_session,
	    handle_feed => \&handle_feed,
	});

    $poe_kernel->run();

    sub init_session {
	my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];
	$heap->{rssagg} = POE::Component::RSSAggregator->new(
	    alias    => 'rssagg',
	    debug    => 1,
	    callback => $session->postback("handle_feed"),
	    tmpdir   => '/tmp', # optional caching
	);
	$kernel->post('rssagg','add_feed',$_) for @feeds;
    }

    sub handle_feed {
	my ($kernel,$feed) = ($_[KERNEL], $_[ARG1]->[0]);
	for my $headline ($feed->late_breaking_news) {
	    # do stuff with the XML::RSS::Headline object
	    print $headline->headline . "\n";
	}
    }

USAGE

AUTHOR

Copyright 2004 Jeff Bisbee <jbisbee@cpan.org>

http://search.cpan.org/~jbisbee/

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

XML::RSS::Feed, XML::RSS::Headline, XML::RSS::Headline::PerlJobs, XML::RSS::Headline::Fark