NAME

Mail::Box::Index - Keep indexfiles on messages.

SYNOPSIS

$folder->readIndex(...)
$folder->writeIndex(...)

DESCRIPTION

Message-folders which store their data in one single file per message are very inefficient for producing subject overviews and detecting message-threads. The Mail::Box::Index is able to store and read a the headers of all messages in one file.

When Mail::Box::Index functionality is switched on (specify keep_index when creating a folder), the index-file is automatically read. When the folder is closed, a new index-file is created.

Special care is taken to avoid a problems when the user changed or removed message-files without updating the index. If the index is not trusted, it will not be used (and so cost performance to the reader of the folder).

METHODS

new ARGS

You will not call this method yourself, unless you implement a folder yourself. The following options can be specified when you create a folder.

  • keep_index => BOOL

    Keep an index-file in the specified file, one file per directory. Using an index-file will speed-up things considerably, because it avoids that all message-files have to be read on the moment that you open the folder. When you open a folder, you need information like the the subject of each message, and it is not pleasant to open all thousands of messages to read them.

  • index_filename => FILENAME

    The FILENAME which is used in each directory to store the headers of all mails. The filename shall not contain a directory path (so: do not use /usr/people/jan/.index, nor subdir/.index, but say .index)

indexFilename

Returns the index-file for a folder. If the keep_index option was not used when the folder was read, this returns undef.

writeIndex MESSAGE [,MESSAGE]

Write an index-file containing the specified messages, but only if the user requested it: the keep_index option of new() must have been specified.

readIndex [HEADERCLASS]

Read the index-file if it exists and the user has specified keep_index with the constructor (new) of this folder. If that option is not specified, the readIndex does not know under what name the index is stored, and therefore not work.

The headers which are read are created into the specified HEADERCLASS, which may be different for each folder-type, but by default a MIME::Head.

AUTHOR

Mark Overmeer (Mark@Overmeer.net). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

VERSION

This code is beta, version 1.004