Mail::...ructed(3pm)
π Mail::Box::Message::Destructed β the manual, bestie edition π
okay so this is Mail::Box::Message::Destructed(3pm) from the User Contributed Perl Documentation section, and it's literally about β¨destructed messagesβ¨. yes that's a real word. sit down, we're doing this π«Ά
β¨ NAME β¨
Mail::Box::Message::Destructed β a destructed message π©Ή
πΈ INHERITANCE πΈ
the family tree goes like this, no cap:
Mail::Box::Message::Destructed
is a Mail::Box::Message
is a Mail::Message
is a Mail::Reporter
so she's a Mail::Box::Message, which is a Mail::Message, which is a Mail::Reporter. generational icon behavior honestly π
π SYNOPSIS π
one line. that's it. that's the whole vibe:
$folder->message(3)->destruct;
call destruct on message 3 of your folder and boom, she's gone π
π¦ DESCRIPTION π¦
okay so picture this: when a message folder gets read, every single message gets parsed into Perl structures. and the header structure specifically? she can eat a HUGE amount of memory. like, alarming amounts. (the message bodies can get moved out to external temporary files, so at least those are chill, but the headers stay.)
so destructed messages are what happens when you forcefully clean up all the header AND body info. everything gets wiped, which makes the object much smaller. some useful information is still hanging around in the object though β she's not completely empty, bestie, just... minimalist π
β οΈ BE WARNED, FR FR: once a message is destructed, it cannot be revived. like, at all. no takebacks, no undo, no "wait actuallyβ". it's giving irreversible.
and it's not just the object that's affected β destructing enforces irreversable deletion from the folder. so if you've got a folder opened read-only, the message will stay in that folder (phew π«Ά). but otherwise it may be deleted. so. yeah. know what you're doing before you do it π
Extends "DESCRIPTION" in Mail::Box::Message.
more parts coming, don't go anywhere π
π METHODS π
Extends "METHODS" in Mail::Box::Message. Yeah bestie, we're building on top of that one, keep up π
π Constructors π
Extends "Constructors" in Mail::Box::Message. More inheritance, we love to see it.
$obj->clone(%options)β inherited, so go read "Constructors" inMail::Message, it's all there π«Ά$class->new($msgid, %options)β okay so heads up: you literally cannot make a destructed message object. Like, at all. That's the whole point of it. The destructing happens over inMail::Box::Message::destruct(). This one improves the base, so peek at "Constructors" inMail::Reporterfor the deets.
So here's the option rundown β every single one, no skips π
bodyβ fromMail::Message, defaults toundefbody_typeβ fromMail::Box::Message, defaults to<from folder>deletedβ fromMail::Message, defaults tofalsefield_typeβ fromMail::Message, defaults toundeffolderβ fromMail::Box::Message, defaults to<required>(yes bb it's mandatory)headβ fromMail::Message, defaults toundefhead_typeβ fromMail::Message, defaults toMail::Message::Head::Completelabelsβ fromMail::Message, defaults to+{}messageIdβ fromMail::Message, defaults toundefmessage_idβ fromMail::Message, defaults toundefmodifiedβ fromMail::Message, defaults tofalsesizeβ fromMail::Box::Message, defaults toundeftrustedβ fromMail::Message, defaults tofalse
And now what each one actually means β¨
body => $objectβ the body, as an objectbody_type => CODE|$classβ what kind of body you wantdeleted => BOOLEANβ is it deleted or not, true/false vibefield_type => $classβ class used for fieldsfolder => $folderβ the folder it lives inhead => $objectβ the head, as an objecthead_type => $classβ class used for the headlabels => \@pairs|\%settingsβ labels, either as pairs or as a hashmessageId => $idβ the message idmessage_id => $idβ also the message id (two ways to spell it, be nice)modified => BOOLEANβ has it been modified, true/falsesize => $bytesβ size in bytestrusted => BOOLEANβ trusted or not, true/false
π¦ Attributes π¦
Extends "Attributes" in Mail::Box::Message. Look at us, still extending things.
$obj->bodyType()β inherited, check "Attributes" inMail::Message$obj->fieldType()β inherited, check "Attributes" inMail::Message$obj->folder( [$folder] )β inherited, check "Attributes" inMail::Box::Message$obj->headType()β inherited, check "Attributes" inMail::Message$obj->messageId()β inherited, check "Attributes" inMail::Message$obj->seqnr( [$integer] )β inherited, check "Attributes" inMail::Box::Message
πΈ Constructing a message πΈ
Extends "Constructing a message" in Mail::Box::Message. So many inherited methods, it's giving family reunion π«Ά
$obj->bounce( [<$rg_object|%options>] )β inherited, see "Constructing a message" inMail::Message::Construct::Bounce$class->build( [$message|$part|$body], @fields, %options )β inherited, see "Constructing a message" inMail::Message::Construct::Build$class->buildFromBody($body, [$head], $headers)β inherited, see "Constructing a message" inMail::Message::Construct::Build$obj->forward(%options)β inherited, see "Constructing a message" inMail::Message::Construct::Forward$obj->forwardAttach(%options)β inherited, see "Constructing a message" inMail::Message::Construct::Forward$obj->forwardEncapsulate(%options)β inherited, see "Constructing a message" inMail::Message::Construct::Forward$obj->forwardInline(%options)β inherited, see "Constructing a message" inMail::Message::Construct::Forward$obj->forwardNo(%options)β inherited, see "Constructing a message" inMail::Message::Construct::Forward$obj->forwardPostlude()β inherited, see "Constructing a message" inMail::Message::Construct::Forward$obj->forwardPrelude()β inherited, see "Constructing a message" inMail::Message::Construct::Forward$obj->forwardSubject(STRING)β inherited, see "Constructing a message" inMail::Message::Construct::Forward$class->read($fh|$text|\$text|\@lines, %options)β inherited, see "Constructing a message" inMail::Message::Construct::Read$obj->rebuild(%options)β inherited, see "Constructing a message" inMail::Message::Construct::Rebuild$obj->reply(%options)β inherited, see "Constructing a message" inMail::Message::Construct::Reply$obj->replyPrelude( [STRING|$field|$address|\@addrs|\@fields] )β inherited, see "Constructing a message" inMail::Message::Construct::Reply$any->replySubject(STRING)β inherited, see "Constructing a message" inMail::Message::Construct::Reply
π The message π
Extends "The message" in Mail::Box::Message. Main character energy, honestly.
$obj->container()β inherited, see "The message" inMail::Message$obj->copyTo($folder, %options)β inherited, see "The message" inMail::Box::Message$obj->endsOnNewline()β inherited, see "The message" inMail::Message$obj->isDummy()β inherited, see "The message" inMail::Message$obj->isPart()β inherited, see "The message" inMail::Message$obj->moveTo($folder, %options)β inherited, see "The message" inMail::Box::Message$obj->partNumber()β inherited, see "The message" inMail::Message$obj->print( [$fh] )β inherited, see "The message" inMail::Message$obj->send( [$mailer], %options )β inherited, see "The message" inMail::Message$obj->size()β inherited, see "The message" inMail::Message$obj->toplevel()β inherited, see "The message" inMail::Message$obj->write( [$fh] )β inherited, see "The message" inMail::Message
β¨ The header β¨
Extends "The header" in Mail::Box::Message.
$obj->bcc()β inherited, see "The header" inMail::Message$obj->cc()β inherited, see "The header" inMail::Message$obj->date()β inherited, see "The header" inMail::Message$obj->destinations()β inherited, see "The header" inMail::Message$obj->from()β inherited, see "The header" inMail::Message$obj->get($fieldname)β inherited, see "The header" inMail::Message$obj->guessTimestamp()β inherited, see "The header" inMail::Message$obj->head( [$head] )β okay so whenundefgets passed in as $head, nothing changes at all, it just returns silently, no drama π«Ά But in every other case, this method is gonna start complaining that the header has been removed. Improves the base, see "The header" inMail::Message$obj->nrLines()β inherited, see "The header" inMail::Message$obj->sender()β inherited, see "The header" inMail::Message$obj->study($fieldname)β inherited, see "The header" inMail::Message$obj->subject()β inherited, see "The header" inMail::Message$obj->timestamp()β inherited, see "The header" inMail::Message$obj->to()β inherited, see "The header" inMail::Message
π The body π
Extends "The body" in Mail::Box::Message.
$obj->body( [$body] )β same deal as the header one, bestie: passundefas $body and literally nothing happens, it just returns quietly π Any other case, it will complain that the body data has been removed. Improves the base, see "The body" inMail::Message$obj->contentType()β inherited, see "The body" inMail::Message$obj->decoded(%options)β inherited, see "The body" inMail::Message$obj->encode(%options)β inherited, see "The body" inMail::Message$obj->isMultipart()β inherited, see "The body" inMail::Message$obj->isNested()β inherited, see "The body" inMail::Message$obj->parts( [<'ALL'|'ACTIVE'|'DELETED'|'RECURSE'|$filter>] )β inherited, see "The body" inMail::Message
π Flags π
Extends "Flags" in Mail::Box::Message.
$obj->delete()β inherited, see "Flags" inMail::Message$obj->deleted( [BOOLEAN] )β inherited, see "Flags" inMail::Message$obj->isDeleted()β inherited, see "Flags" inMail::Message$obj->isModified()β inherited, see "Flags" inMail::Message$obj->label($label|PAIRS)β so yeah, you can delete a destructed message, no problem. But you cannot undelete it. That's just how it is. Improves the base, see "Flags" inMail::Message$obj->labels()β inherited, see "Flags" inMail::Message$obj->labelsToStatus()β inherited, see "Flags" inMail::Message$obj->modified( [$flag] )β inherited, see "Flags" inMail::Message$obj->statusToLabels()β inherited, see "Flags" inMail::Message
π The whole message as text π
Extends "The whole message as text" in Mail::Box::Message.
$obj->file()β inherited, see "The whole message as text" inMail::Message::Construct::Text$obj->lines()β inherited, see "The whole message as text" inMail::Message::Construct::Text$obj->printStructure( [$fh|undef],[$indent] )β inherited, see "The whole message as text" inMail::Message::Construct::Text$obj->string()β inherited, see "The whole message as text" inMail::Message::Construct::Text
π Internals π
Extends "Internals" in Mail::Box::Message. Down bad in the guts of it all π₯
$obj->clonedFrom()β inherited, see "Internals" inMail::Message$class->coerce($message)β coerces aMail::Box::Messageinto destruction π Improves the base, see "Internals" inMail::Message
Example of coercion to death:
Mail::Box::Message::Destructed->coerce($folder->message(1));
$folder->message(1)->destruct; # same
my $msg = $folder->message(1);
Mail::Box::Message::Destructed->coerce($msg);
$msg->destruct; # same
$obj->diskDelete()β inherited, see "Internals" inMail::Box::Message$obj->isDelayed()β inherited, see "Internals" inMail::Message$obj->isTrusted()β inherited, see "Internals" inMail::Message$obj->readBody( $parser, $head, [$bodytype] )β inherited, see "Internals" inMail::Box::Message$obj->readFromParser( $parser, [$bodytype] )β inherited, see "Internals" inMail::Message$obj->readHead( $parser, [$class] )β inherited, see "Internals" inMail::Message$obj->recursiveRebuildPart($part, %options)β inherited, see "Internals" inMail::Message::Construct::Rebuild$obj->storeBody($body)β inherited, see "Internals" inMail::Message$obj->takeMessageId( [STRING] )β inherited, see "Internals" inMail::Message
π Error handling π
Extends "Error handling" in Mail::Box::Message. It's giving damage control, and honestly? Fair.
$obj->AUTOLOAD()β inherited, see "METHODS" inMail::Message::Construct$obj->notImplemented()β inherited, see "Error handling" inMail::Reporter$any->shortSize( [$value] )β inherited, see "Error handling" inMail::Message$obj->shortString()β inherited, see "Error handling" inMail::Message
π§ Cleanup π§
Extends "Cleanup" in Mail::Box::Message. Time to go, besties π
$obj->DESTROY()β inherited, see "Cleanup" inMail::Reporter$obj->destruct()β inherited, see "Cleanup" inMail::Box::Message
β DETAILS β
Extends "DETAILS" in Mail::Box::Message. Yeah, that's it. Go read that one, iykyk π
π DIAGNOSTICS π
okay bestie, this is the part where Perl yells at you. Every one of these is a real message your code can trip over, and yes, each one tells you which method cast it, so you know exactly who to blame. iykyk. π₯
Error: Cannot include forward source as $kind.β you handedforward(include)an alternative it doesn't know. the valid choices are"NO","INLINE","ATTACH", and"ENCAPSULATE". Cast byforward().Error: No default mailer found to send message.β thesend()mechanism didn't have enough info to automatically hunt down a mail transfer agent to send this message with. tell it a mailer explicitly using the"via"options. Cast bysend().Error: You cannot take the head/body of a destructed messageβ the message came from a folder, but its memory got freed-up forcefully byMail::Box::Message::destruct(). apparently your program is still trying to reach the header or body data after that destruction, which honestly? not possible. Cast byhead().Error: cannot include reply source as $kind.β unknown alternative for the"include"option ofreply(). valid choices are"NO","INLINE", and"ATTACH". Cast byreply().Error: cannot read message from a $source.β Cast byread().Error: class $package does not implement method $method.β fatal error bestie: that specific$package(or one of its superclasses) does not implement this method where it should. what it actually means is that some other related classes do implement this method, but the class you're holding does not. you should probably investigate this, and probably go tell the author of the package. Cast bynotImplemented().Error: destructed message can not be undeletedβ once a message is destructed it can not be revived. destruction is an optimization in memory usage: if you need an undelete functionality, then you can not useMail::Box::Message::destruct(). Cast bylabel().Error: destructed message has no labels except 'deleted', requested is $label.β Cast bylabel().Error: destructed message has no labels except 'deleted', trying to set @labels.β Cast bylabel().Error: method bounce requires To, Cc, or Bcc.β thebounce()method forwards a received message off to someone else without modification, so you must specify its new destination. if you have the urge not to specify any destination, you're probably looking forreply(). when you wish to modify the content, useforward(). Cast bybounce().Error: method forwardAttach requires a preamble.β Cast byforwardAttach().Error: method forwardEncapsulate requires a preamble.β Cast byforwardEncapsulate().Error: method forwardNo requires a To.β Cast byforwardNo().Error: method forwardNo requires a body.β Cast byforwardNo().Error: no rebuild rule $name defined.β Cast byrebuild().Error: only build() Mail::Message's; they are not in a folder yet.β so you wanna construct a message to be stored in some kind of folder, but babes, you need to do that in two steps. first, create a normalMail::Message, and then add it to the folder. during thatMail::Box::addMessage()process the message will getcoerce()-d into the right message type, adding storage information and the like. Cast bybuild().Error: select parts via '$what'?β Cast byparts().Warning: skipped unknown key '$key' in build.β Cast bybuild().Error: you cannot coerce a $class into destruction.β only realMail::Box::Messageobjects can get destructed intoMail::Box::Message::Destructedobjects.Mail::Messagefree their memory immediately when the last reference is lost. Cast bycoerce().Error: you cannot instantiate a destructed message.β you cannot instantiate a destructed message object directly, no cap. destruction is done by callingMail::Box::Message::destruct()on any existing folder message. Cast bynew().Error: you cannot set the body on a destructed message.β Cast bybody().Error: you cannot set the head on a destructed message.β Cast byhead().Error: you cannot set the modified flag on a destructed message.β Cast bymodified().Error: you cannot take the body of a destructed message.β Cast bybody().Error: you cannot take the head of a destructed message.β Cast byhead().
π SEE ALSO π
this module is part of Mail-Box version 4.02, built on April 10, 2026.
Website: http://perl.overmeer.net/CPAN/ β¨
π 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. periodt. π
okay that's the whole page, bestie, you made it to the end and you ate π«Ά this was Mail::...ructed(3pm), running on perl v5.40.1, dated 2026-05-09 β go forth and destruct responsibly ππ
π¦ 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