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 - Babble document container class

DESCRIPTION

A Babble::Document object represents one entry in the whole collection a Babble is working with.

PROPERTIES

A Babble::Document object has the following basic properties:

author

The author of the document.

title

Title of the document.

subject

Subject of the document.

date

Submission date of the document.

id

A unique ID of the document, usually a hyperlink.

content

The actual content of the document.

Other properties might be present, but they are not standardised by this class. However, preprocessors and DataSources are free to add others.

METHODS

    new()

    Creates a new Babble::Document object. Recognises the default properties mentioned above as arguments.

    date()

    Get or set the submission date of the document, depending on having an argument or not.

    date_iso()

    Returns the submission date of the document in the "YYYY-MM-DD HH:MM:SS" format.

    date_rss()

    Returns the submission date of the document in a format suitable for putting into an RSS item's dc:date field.

    date_text()

    Returns the submission date of the document in human readable format.

    date_date()

    Returns only the date part of the documents submission date.

    search()

    Given a list of filters (see later), checks if the document matches all the criteria specified in them. If yes, returns an array consisting of the Babble::Document object. Otherwise returns an empty array.

    The filters are simple hashrefs, with two mandatory keys: field and pattern. The first one determines which field the search is performed on (this can be any one of the available Babble::Document properties), and pattern is the pattern it should match.

    Optional keys include inverse, which reverses the check, and transform, which is a code reference, which will be applied to the source filed before comparsion.

    all()

    Return ourselves. This is mostly here so that Babble::Document::Collection->all() can call $doc->all(), which in turn makes it possible to have Babble::Document::Collections nested, and still work.

AUTHOR

Gergely Nagy, algernon@bonehunter.rulez.org

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

SEE ALSO

Babble, Babble::Document::Collection

1 POD Error

The following errors were encountered while parsing the POD:

Around line 74:

You can't have =items (as at line 80) unless the first thing after the =over is an =item