use Mail::Box::MH; my $folder = new Mail::Box::MH folder => $ENV{MAIL}, ...;
See SYNOPSIS in Mail::Box::Dir
This documentation describes how MH mailboxes work, and what you
can do with the MH folder object Mail::Box::MH
.
See DESCRIPTION in Mail::Box::Dir
See Different kinds of folders in Mail::Box
See Available folder types in Mail::Box
See Folder class implementation in Mail::Box
MH-type folders use a directory to store the messages of one folder. Each message is stored in a separate file. This seems useful, because changes in a folder change only a few of these small files, in contrast with file-based folders where changes in a folder cause rewrites of huge folder files.
However, MH-based folders perform very bad if you need header information of all messages. For instance, if you want to have full knowledge about all message-threads (see Mail::Box::Thread::Manager) in the folder, it requires to read all header lines in all message files. And usually, reading your messages in threads is desired.
So, each message is written in a separate file. The filenames are
numbers, which count from 1
. Next to these message files, a
directory may contain a file named .mh_sequences
, storing labels which
relate to the messages. Furthermore, a folder-directory may contain
sub-directories, which are seen as sub-folders.
This implementation supports the .mh-sequences
file and sub-folders.
Next to this, considerable effort it made to avoid reading each message-file.
This should boost performance of the MailBox distribution over other
Perl-modules which are able to read folders.
Folder types which store their messages each in one file, together in one directory, are bad for performance. Consider that you want to know the subjects of all messages, while browser through a folder with your mail-reading client. This would cause all message-files to be read.
Mail::Box::MH has two ways to try improve performance. You can use an index-file, and use on delay-loading. The combination performs even better. Both are explained in the next sections.
If you specify new(keep_index), then all header-lines of all messages
from the folder which have been read once, will also be written into
one dedicated index-file (one file per folder). The default filename
is .index
However, index-files are not supported by any other reader which supports MH (as far as I know). If you read the folders with such I client, it will not cause unrecoverable conflicts with this index-file, but at most be bad for performance.
If you do not (want to) use an index-file, then delay-loading may save your day.