VERSION

2.212

SYNOPSIS

A quick and dirty non-POE example that uses a blocking sleep. The magic is in the late_breaking_news method that returns only headlines it hasn't seen.

    use XML::RSS::Feed;
    use LWP::Simple qw(get);

my $feed = XML::RSS::Feed->new( url => "http://www.jbisbee.com/rdf/", name => "jbisbee", delay => 10, debug => 1, tmpdir => "/tmp", # optional caching );

while (1) { $feed->parse(get($feed->url)); print $_->headline . "\n" for $feed->late_breaking_news; sleep($feed->delay); }

\s-1ATTENTION\s0! - If you want a non-blocking way to watch multiple \s-1RSS\s0 sources with one process use POE::Component::RSSAggregator.

CONSTRUCTOR

Required Params
* name

Identifier and hash lookup key for the \s-1RSS\s0 feed.

* url

The \s-1URL\s0 of the \s-1RSS\s0 feed

Optional Params
* delay

Number of seconds between updates (defaults to 600)

* tmpdir

Directory to keep a cached feed (using Storable) to keep persistance between instances.

* debug

Turn debuging on.

* headline_as_id

Boolean value to use the headline as the id when \s-1URL\s0 isn't unique within a feed.

* hlobj

A class name sublcassed from XML::RSS::Headline

* max_headlines

The max number of headlines to keep. (default is unlimited)

METHODS

Pass in a xml string to parse with \s-1XML::RSS\s0 and then call process to process the results. Calls pre_process, process_items, post_process, title, and link methods to process the parsed results of an \s-1RSS\s0 \s-1XML\s0 feed.

* $items

An array of hash refs which will eventually become XML::RSS::Headline objects. Look at XML::RSS::Headline->new() for acceptable arguments.

* $title

The title of the \s-1RSS\s0 feed.

* $link

The \s-1RSS\s0 channel link (normally a \s-1URL\s0 back to the homepage) of the \s-1RSS\s0 feed.

\$1

Mark all headlines from previous run as seen. Turn an array refs of hash refs into XML::RSS::Headline objects and added to the internal list of headlines. Post process cleanup, cache headlines (if tmpdir), and debug messages. Create a new XML::RSS::Headline object and add it to the interal list. Check XML::RSS::Headline->new() for acceptable values for %args. Returns the number of headlines for the feed. Just a boolean test to see if we've seen a headline or not. Returns an array or array reference (based on context) of XML::RSS::Headline objects Returns an array or the number of elements (based on context) of the latest XML::RSS::Headline objects. If tmpdir is defined the rss info is cached. Set the time of when the feed was last processed. If you pass in a value it will be used otherwise calls Time::HiRes::time. The time (in epoch seconds) of when the feed was last processed. The time (in epoch seconds and milliseconds) of when the feed was last processed.

SET/GET ACCESSOR METHODS

The title of the \s-1RSS\s0 feed. Turn on debugging messages init is used so that we just load the current headlines and don't return all headlines. in other words we initialize them. Takes a boolean argument. The identifier of an \s-1RSS\s0 feed. Number of seconds between updates. The url in the \s-1RSS\s0 feed with a link back to the site where the \s-1RSS\s0 feed came from. The url in the \s-1RSS\s0 feed with a link back to the site where the \s-1RSS\s0 feed came from. Within some \s-1RSS\s0 feeds the \s-1URL\s0 may not always be unique, in these cases you can use the headline as the unique id. The id is used to check whether or not a feed is new or has already been seen. Ablity to use a subclass of XML::RSS::Headline. (See Perl Jobs example in XML::RSS::Headline::PerlJobs). This should just be the name of the subclass. Temporay directory to store cached \s-1RSS\s0 \s-1XML\s0 between instances for persistance. The maximum number of headlines you'd like to keep track of. (0 means infinate)

DEPRECATED METHODS

This should was deprecated because, the object shouldn't really know anything about fetching, it just processes the results. This method currently will always return false This method was deprecated because, $feed->parse now returns a bool value. This method will always return false

AUTHOR

Jeff Bisbee, \*(C`<jbisbee at cpan.org>\*(C'

BUGS

Please report any bugs or feature requests to \*(C`bug-xml-rss-feed at rt.cpan.org\*(C', or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-RSS-Feed>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc XML::RSS::Feed

You can also look for information at:

* AnnoCPAN: Annotated \s-1CPAN\s0 documentation

<http://annocpan.org/dist/XML-RSS-Feed>

* \s-1CPAN\s0 Ratings

<http://cpanratings.perl.org/d/XML-RSS-Feed>

* \s-1RT:\s0 \s-1CPAN\s0's request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=XML-RSS-Feed>

* Search \s-1CPAN\s0

<http://search.cpan.org/dist/XML-RSS-Feed>

ACKNOWLEDGEMENTS

Special thanks to Rocco Caputo, Martijn van Beers, Sean Burke, Prakash Kailasa and Randal Schwartz for their help, guidance, patience, and bug reports. Guys thanks for actually taking time to use the code and give good, honest feedback.

COPYRIGHT & LICENSE

Copyright 2006 Jeff Bisbee, all rights reserved.

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

RELATED TO XML::RSS::Feed…

XML::RSS::Headline, XML::RSS::Headline::PerlJobs, XML::RSS::Headline::Fark, XML::RSS::Headline::UsePerlJournals, POE::Component::RSSAggregator