Mail::...:Index(3pm)
π NAME π
Mail::Box::MH::Index β bestie, this one keeps index files for messages π
This page lives in the User Contributed Perl Documentation neighborhood (section 3pm), so you already know it's a Perl module and not some dusty old command you type at a prompt β¨
πΈ INHERITANCE πΈ
Mail::Box::MH::Index
is a Mail::Reporter
So like, it's a Mail::Reporter at heart, and it inherits all that reporter energy π
π¦ SYNOPSIS π¦
my $index = Mail::Box::MH::Index->new;
$index->read(...)
$index->write(...)
That's the whole vibe check. Make one, read it, write it. Periodt. π
β¨ DESCRIPTION β¨
Okay so picture this: message folders that store every single message in one file per message. Cute in theory, right? But literally the worst for building subject overviews and for figuring out message threads π It's giving "why are we like this."
Enter Mail::Box::MH::Index β it's the object that can store and read the headers of a whole set of Mail::Box::MH::Message messages that all belong to a single Mail::Box::MH folder, and it does it all in one file π
When the Mail::Box::MH::Index functionality is enabled β which you do by specifying Mail::Box::MH::new(keep_index) when you open a folder β the index file gets read automatically, no cap. And when the folder is closed, a brand new index file is created. Slay.
Special care is taken (yes, actual care, we're thoughtful like that π«Ά) to dodge the problems that pop up when the user changes or removes message files without updating the index. And if the index is not trustworthy? It simply will not be used β which costs some performance for whoever's reading the folder. Trade-offs, bestie, it's called boundaries. π
Extends "DESCRIPTION" in Mail::Reporter.
π METHODS π
Extends "METHODS" in Mail::Reporter.
π§ Constructors
Extends "Constructors" in Mail::Reporter.
$class->new(%options)β Inherited, see"Constructors"in Mail::Reporter
The options it takes, with their defaults:
-Option --Default
filename <required>
head_type Mail::Message::Head::Subset
head_wrap 72
filename => $fileβ This is the$fileused to store the headers of all the e-mails for one folder. Heads up: this must be an absolute pathname βhead_type => $classβ The type of headers that will be used to store header info when it's read from the index file. You can not be sure the index contains every header line (because the mailbox may have been updated without updating the index), so this will usually be β an sub-class of βMail::Message::Head::Subsetπhead_wrap => $nrcharsβ The preferred maximum number of characters in each header line.
π Attributes
Extends "Attributes" in Mail::Reporter.
$obj->filename()β Returns the name of the index file. That's it, that's the whole method π
π₯ Error handling
Extends "Error handling" in Mail::Reporter.
$obj->AUTOLOAD()β Inherited, see"Error handling"in Mail::Reporter$obj->notImplemented()β Inherited, see"Error handling"in Mail::Reporter
π§Ό Cleanup
Extends "Cleanup" in Mail::Reporter.
$obj->DESTROY()β Inherited, see"Cleanup"in Mail::Reporter
π The Index
$obj->append(@messages)β Append@messagesto the index file. Simple. Iconic. π$obj->get($msgfile)β Look if there is header info for the specified$msgfile. That filename represents one message in a folder type which is organized as a directory. This method returns an object of thenew(head_type)as specified when you created the index object β or it returns"undef"if the information is not known or not trustworthy, i.e. the file size changed. π$obj->read()β Read the index file. After this, the header objects can be requested with theget()method. Main character energy π¦$obj->write(@messages)β Write an index file containing the headers specified in@messages(Mail::Messageobjects). π
π DIAGNOSTICS π
- Error: MH index requires a filename. β Cast by
new() - Error: class $package does not implement method $method. β Fatal error: the specific
$package(or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast bynotImplemented()
Not me getting a fatal error at 2am π Investigate, then go tell the author, bestie. Politely.
π SEE ALSO π
This module is part of Mail-Box version 4.02, built on April 10, 2026.
Website: http://perl.overmeer.net/CPAN/ β go peek, it's giving very much iykyk πΈ
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2001-2026 by Mark Overmeer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π
okay that's a wrap, bestie π«Ά this was perl v5.40.1, dated 2026-05-09, and honestly? iconic. mwah π
β¨
π¦ where this page comes from
- ubuntu stonking: libmail-box-perl 4.02-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms