Gergely Nagy > Babble > Babble::DataSource::RSS

Download:
Babble-0.07.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Babble::DataSource::RSS - RSS source fetcher for Babble

SYNOPSIS ^

 use Babble;
 use Babble::DataSource::RSS;

 my $babble = Babble->new ();
 $babble->add_sources (
        Babble::DataSource::RSS->new (
                -id => "Gergely Nagy",
                -location => "http://midgard.debian.net/~algernon/blog/index.xml"
        )
 );
 ...

DESCRIPTION ^

Babble::DataSource::RSS implements a Babble data source class that parses an arbitary RSS feed.

METHODS ^

_rss_date_parse($date)

Attempts to parse a few date formats found in RSS feeds with which Date::Manip can't do anything with.

Returns the date either in the new format, or the original.

collect_rss([$babble])

Collects the RSS feed, either from the network, or from the cache.

If a -cache_parsed option was set when creating the object, the parsed data will be stored in the cache. This can speed up processing considreably, yet it needs much more memory too.

The only - optional - argument is a reference to a Babble object.

Returns the source feed (a string scalar) or undef on error.

feed_parse ($feed[, $babble])

Attempt to parse the feed, and store it in the cache, if so need be.

The first parameter passed to this method is a reference to the source feed (a string scalar). The second, optional argument, is a reference to a Babble object. Used to access the cache.

Returns an XML::RSS object, or undef on error.

rss_channel_to_collection ($rss[, $babble])

Takes an XML::RSS object, and extracts information from it into a Babble::Document::Collection object.

The first parameter to this method is a reference to an XML::RSS object, the second - optional - one is a reference to a Babble object.

Returns a Babble::Document::Collection object.

rss_item_to_document ($collection, $item[, $babble])

Converts an item, as stored by XML::RSS, to a Babble::Document.

The first parameter is a reference to a Babble::Document::Collection, the second is a hash reference, and the last, optional argument is a reference to a Babble object.

Returns a Babble::Document object.

rss_to_collection ($rss[, $babble])

Converts an XML::RSS object to a Babble::Document::Collection, extracting meaningful data on the way.

This is mostly a wrapper around rss_channel_to_collection and rss_item_to_document.

As such, the first parameter is a reference to an XML::RSS object, while the optional second one is a reference to a Babble object.

Returns a Babble::Document::Collection object.

collect([$babble])

This one does the bulk of the job, fetching the feed and parsing it, then returning a Babble::Document::Collection object.

However, most of the work is delegated to collect_rss, feed_parse and rss_to_collection, for easier code reuse in sub-classes.

AUTHOR ^

Gergely Nagy, algernon@bonehunter.rulez.org

Bugs should be reported at http://bugs.bonehunter.rulez.org/babble.

SEE ALSO ^

Babble::Document, Babble::Document::Collection, Babble::DataSource, Babble::Transport

syntax highlighting: