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::Document::Collection - Babble document collector class

DESCRIPTION

Babble::Document::Collection is a meta-class. One, that's sole purpose is to collect Babble::Document objects, and group them together with a little meta-info about them.

PROPERTIES

author

The author of this collection

subject

The subject of the collection.

title

The title of the collection.

id

A unique ID for the collection, usually a hyperlink to the source homepage.

A link to the source of this collection (for example, to an RSS feed).

date

The creation date of this version of the collection.

content

A brief description of the collection

name

The name of the collection. Usually used for subscription lists in the templates. This does not come from the feed, as the others. It must be specified at object creation time. Defaults to author's value if undefined, or title's, if author is undefined too.

METHODS

new()

Creates a new, empty Babble::Document::Collection object. All the properties mentioned above are recognised as paramaters. Aside from those, the -limit_max parameter is recognised too. All the methods this class provides that give back an array of documents will use the value of this parameter to limit the size of the array.

To add documents to the collection, simply push them to @{$collection->{documents}}.

search($filters[, $params])

Given a list of filters (see Babble::Document::search for a specification of filters) in an arrayref, returns all the documents that match the specified criteria. If no matches are found, returns an empty array.

The only recognised parameter is -limit_max.

all()

Return all entries (the lowest level entries) as an array.

sort($params)

Sort all the elements in an aggregation by date, and return the sorted array of items.

The only recognised parameter is -limit_max.

AUTHOR

Gergely Nagy, algernon@bonehunter.rulez.org

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

SEE ALSO

Babble, Babble::Document