The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

    use POE;
    use POE::Component::RSSAggregator;
    use XML::RSS::Feed::Factory;

First define the RSS Feeds you would like to watch

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

Create a new PoCo::RSSAggregator object and use the feed_factory function XML::RSS:Feed::Factory to generate your XML::RSS::Feed objects.

    my $rssagg = POE::Component::RSSAggregator->new(
        feeds    => [feed_factory(@feeds)],
        debug    => 1,
        callback => \&new_headlines,
    );

Tell POE to run

    $poe_kernel->run();

Every time a request is made the rss feed object is returned and you can see if things have changed - $feed->late_breaking_news

    sub handle_feed
    {
        my ($feed) = @_;
        if ($feed->late_breaking_news) {
            for my $headline ($feed->late_breaking_news) {
                print $headline->url . "\n";
            }
        }
    }

USAGE

The short version is that fetch RSS feeds every 'delay' second adn when new headlines are found the XML::RSS::Feed::Headline objects are recived via the registerd call back function.

AUTHOR

        Jeff Bisbee
        CPAN ID: JBISBEE
        jbisbee@cpan.org
        http://www.jbisbee.com/perl/modules/

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::Factory, XML::RSS::Feed, XML::RSS::Feed::Headline