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

Babble - RSS Feed Aggregator and Blog engine

SYNOPSIS

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

 my $babble = Babble->new ();

 $babble->add_params (meta_title => "Example Babble");
 $babble->add_sources (
	Babble::DataSource::RSS->new (
		-id => "Gergely Nagy",
		-location => 'http://bonehunter.rulez.org/~algernon/blog/index.xml',
		-lwp => {
			agent => "Babble/" . $Babble::VERSION . " (Example)"
		}
        )
 );
 $babble->collect_feeds ();

 print $babble->output (-theme => "sidebar");

DESCRIPTION

Babble is a system to collect, process and display RSS feeds. Designed in a straightforward and extensible manner, Babble provides near unlimited flexibility. Even though it provides lots of functionality, the basic usage is pretty simple, and only a few lines.

However, would one want to add new feed item processor functions, that is. also trivial to accomplish.

METHODS

Babble has a handful of methods, all of them will be enumerated here.

new()

Creates a new Babble object. Arguments to the new method are listed below, all of them are optional. All arguments passed to new will be stored without parsing, for later use by processors and other extensions.

-processors

An array of subroutines that Babble will run for each and every item it processes. See the PROCESSORS section for more information about these matters.

-limit_max

The maximum number of items in the collection. This will be used by the top-level Babble::Document::Collection object, see the documentation of that class for further details.

add_params(%params)

Add custom paramaters to the Babble object, which might be usable for the output generation routines.

See the documentation of the relevant output method for details.

add_sources(@sources)

Adds multiple sources in one go.

collect_feeds()

Retrieve and process the feeds that were added to the Babble. All processor routines will be run by this very method.

Please note that this must be called before the output method!

sort([$params])

Sort all the elements in an aggregation by date, and return the sorted array of items. Leaves the work to Babble::Document::Collection->sort().

all([$params])

Return all items in an aggregation as an array.

output(%params)

Generate the output. This methods recognises two arguments: type, which determines what output method will be used for the actual output itself, and theme, which overrides this, and uses a theme engine instead. (A theme engine is simply a wrapper around a specific output method, with some paramaters pre-filled.)

The called module needs to be named Babble::Output::$type or Babble::Theme::$theme, and must be a Babble::Output descendant.

search()

Dispatch everything to Babble::Document::Collection->search().

PROCESSORS

Processors are subroutines that take four arguments: An item, a channel, a source, and a Babble object (the caller). All of them are references.

An item is a Babble::Document object, channel is a Babble::Document::Collection object, and source is a Babble::DataSource object.

Preprocessors operate on item in-place, doing whatever they want with it, being it adding new fields, modifying others or anything one might come up with.

A default set of preprocessors, which are always run first (unless special hackery is in the works), are provided in the Babble::Processors module. Since they are automatically used, one does not need to add them explicitly.

AUTHOR

Gergely Nagy, algernon@bonehunter.rulez.org

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

SEE ALSO

Babble::DataSource, Babble::Document, Babble::Document::Collection, Babble::Output, Babble::Theme, Babble::Processors