View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Gergely Nagy > Babble > Babble::DataSource::Mail



Annotate this POD


New  1
Open  0
View/Report Bugs


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


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

 my $babble = Babble->new ();
 $babble->add_sources (
        Babble::DataSource::Mail->new (
                -location => "babble.mbox",
                -permalink_base => ''


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.



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.


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.


Gergely Nagy,

Bugs should be reported at


Babble::Document, Babble::Document::Collection, Babble::DataSource, Mail::Box

syntax highlighting: