Gergely Nagy > Babble > Babble::DataSource::Mail

Download:
Babble-0.07.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Babble::DataSource::Mail - Fetch documents from mail archives

SYNOPSIS ^

 use Babble;
 use Babble::DataSource::Mail;

 my $babble = Babble->new ();
 $babble->add_sources (
        Babble::DataSource::Mail->new (
                -location => "babble.mbox",
                -permalink_base => 'http://example.org/~me/blog/'
        )
 );
 ...

DESCRIPTION ^

Babble::DataSource::Mail implements a Babble data source class that fetches documents from mailboxes, maildirs, or anything Mail::Box supports.

This can be used in a setup where one filters blog entries into a separate mailbox, and uses this module to generate the blog itself.

METHODS ^

new(%params)

This method creates a new object. The recognised arguments are -location, which specifies the directory where documents should be collected from; -permalink_base, the base URL for the collection (used by the permanent link generator, see later); and -permalink_gen, a code reference that is used to generate links to documents.

The method specified in -permalink_gen takes four arguments: base, msgid, subject and date. All of them are strings, except the first, which is a string reference.

Base is what we specified using -permalink_base, msgid is the message id, and subject is the subject of the mail.

collect()

This function processes each message in a mail folder, and makes a Babble::Document out of them. The title of the document is the subject of the mail, author is the sender, the content is the body, the subject (category) of the document can be set using the X-Category header.

The documents id property contains a pointer to the entry (eg, to one's weblog). This is generated by the $source->{permalink_gen} function, explained above.

For the Babble::Document::Collection object to return, some information will be gathered from the Babble object which calls this method, or from the parameters passed to us. Namely, the meta_title, meta_desc, meta_link, meta_owner, meta_owner_email, meta_subject, meta_image and meta_feed_link keys will be used, if present.

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, Mail::Box

syntax highlighting: