NAME

POE::Component::RSSAggregator - A Simple POE RSS Aggregator

SYNOPSIS

    #!/usr/bin/perl -w
    use strict;
    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

The premise is this, you watch RSS feeds for new headlines to appear and when they do you trigger an event handle them. The handle_feed event is given a XML::RSS::Feed object every time new headlines are found.

AUTHOR

Jeff Bisbee CPAN ID: JBISBEE jbisbee@cpan.org http://search.cpan.org/author/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