Mail::...d::Node(3pm)

πŸ’– Mail::Box::Thread::Node (3pm) πŸ’–

okay bestie, we're doing the whole Mail::Box::Thread::Node(3pm) thing and it's literally the page about one single node in a message thread 🧡✨


🌸 NAME 🌸

Mail::Box::Thread::Node β€” one node in a message thread πŸŽ€

πŸ¦‹ INHERITANCE πŸ¦‹

Mail::Box::Thread::Node
  is a Mail::Reporter

so yeah, Mail::Box::Thread::Node is a Mail::Reporter, that's the family tree πŸ’…

✨ SYNOPSIS ✨

my $node = Mail::Box::Thread::Node->new;
$node->addMessage($message);
...

πŸ’œ DESCRIPTION πŸ’œ

So Mail::Box::Thread::Node maintains one node in the linked list of threads 🧡 Each node contains one message, plus a list of its follow-ups. On top of that, it refers to its own ancestor and carries info about the trustworthiness of that relationship πŸ‘‘

To complicate things a little (and it's giving chaos, lowkey), because the thread-manager can maintain multiple folders, and merge their content, you may find the same message in more folders πŸ˜΅πŸ’« All versions of the same message (based on message-id) are stored in the same node β€” one node, many clones, iconic behavior fr fr.

Extends "DESCRIPTION" in Mail::Reporter 🫢


πŸŽ€ METHODS πŸŽ€

Extends "METHODS" in Mail::Reporter.

πŸ’– Constructors

Extends "Constructors" in Mail::Reporter.

$class->new(%options)

You will not call this method yourself 🚫 The Mail::Box::Thread::Manager object will call it to construct Mail::Box::Thread::Node objects. Either a message or a messageId must be supplied. Improves base, see "Constructors" in Mail::Reporter.

-Option    --Default
 dummy_type  undef
 message     undef
 messageId   undef
  • dummy_type => $class β€” Indicates the $class name of dummy messages. Dummy messages are placeholders in a Mail::Box::Thread::Manager data structure πŸ•³οΈ
  • message => $message β€” The $message which is stored in this node. The $message object must be a Mail::Box::Message πŸ“©
  • messageId => $msgid β€” The $msgid for the message which is stored in this node. Only specify it when you don't have the message yet ⏳

🌈 Attributes

Extends "Attributes" in Mail::Reporter.

$obj->isDummy()

Returns true if the message is a dummy πŸ«₯ A dummy is a "hole" in a thread which has follow-ups but does not have a message. Not me making holes in the timeline 😭

$obj->messageId()

Return the message-id related to this thread node πŸ”– Each of the messages listed in this node will have the same ID. Periodt.

🚨 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 thread node

$obj->addMessage($message)

Add one message to the thread node πŸ’Œ If the node contains a dummy, then the dummy is replaced πŸ‘‹ Otherwise, the message is added to the end of the list.

$obj->expand( [BOOLEAN] )

Returns whether this (part of the) folder has to be shown expanded or not πŸͺ— This is simply done by a label, which means that most folder types can store this.

$obj->message()

Get the message which is stored in this thread node πŸ“¬ NOTE: the same message may be located in many folders at the same time, and these folders may be controlled by the same thread manager. The way that one message is in multiple places at once, it's giving multiverse πŸŒ€

In SCALAR context, this method returns the first instance of the message that is not deleted πŸ™…β€β™€οΈ If all instances are flagged for deletion, then you get the first deleted message. When the open folders only contain references to the message, but no instance, you get a dummy message (see Mail::Message::Dummy).

In list context, all instances of the message which have been found are returned πŸ“œ

Β» example:

my $threads = $mgr->threads(folders => [$draft, $sent]);
my $node    = $draft->message(1)->thread;

foreach my $instance ($node->message) {
   print "Found in ", $instance->folder, ".\n";
}

print "Subject is ", $node->message->subject, ".\n";

πŸ”— The thread order

$obj->followUps()

Returns the list of follow-ups to this thread node πŸ‘― This list may contain parsed, not-parsed, and dummy messages.

$obj->followedBy($threads)

Register that the $threads are follow-ups to this message πŸ“ These follow-ups need not be related to each other in any way other than sharing the same parent.

Defining the same relation more than once will not cause information to be duplicated πŸ™…β€β™€οΈ no copy-paste drama here.

$obj->follows($thread, $quality)

Register that the current thread is a reply to the specified $thread ↩️ The $quality of the relation is specified by the second argument. The method returns undef if the link is not accepted in order to avoid circular references πŸ”„πŸš« (we do not do infinite loops in this house).

The relation may be specified more than once, but only the most confident relation is used πŸ’ͺ For example, if a reply ($quality equals REPLY) is specified, later calls to the follow method will have no effect. If follows is called with a $quality that matches the current quality, the new thread overrides the previous.

$obj->repliedTo()

Returns the message(s) to which the message in this node replies πŸ’¬ In scalar context, this method will return the message to which the message in this node replies. This message object may be a dummy message.

If the message seems to be the first message of a thread, the value undef is returned 🌱 (Remember that some MUA are not adding reference information to the message's header, so you can never be sure a message is the start of a thread β€” the way you can never be sure who started the group chat 😭)

In list context, this method returns a second string value indicating the confidence that the messages are related πŸ“Š When extended thread discovery is enabled, then some heuristics are applied to determine if messages are related. Values for the STRING may be:

  • 'REPLY' β€” This relation was directly derived from an in-reply-to message header field. The relation has a high confidence πŸ‘‘
  • 'REFERENCE' β€” This relation is based on information found in a Reference message header field. One message may reference a list of messages which precede it in the thread. The heuristic attempts to determine relationships between messages assuming that the references are in order. This relation has a lower confidence πŸ“‰
  • 'GUESS' β€” The relation is a big guess, with low confidence πŸ€·β€β™€οΈ It may be based on a subject which seems to be related, or commonalities in the message's body.

More constants may be added later πŸ‘€

Β» example:

my $question = $answer->repliedTo;
my ($question, $quality) = $answer->repliedTo;
if($question && $quality eq 'REPLY') { ... };

$obj->sortedFollowUps( [$prepare, [$compare]] )

Returns the list of followUps(), but sorted πŸ”€ By default sorting is based on the estimated time of the reply. See startTimeEstimate().

🌍 On the whole thread

Some convenience methods are added to threads, to simplify retrieving information from it πŸ’β€β™€οΈ

$obj->endTimeEstimate()

Returns a guess as to when the thread has ended ⏰ (although you never know for sure whether there fill follow messages in the future β€” bestie the future is unpredictable, no cap).

$obj->ids()

Returns all the ids in the thread starting at the current thread node πŸ†”

Β» example:

$newfolder->addMessages($folder->ids($thread->ids));
$folder->delete($thread->ids);

$obj->numberOfMessages()

Number of messages in the thread starting at the current thread node, but not counting the dummies πŸ”’

$obj->recurse(CODE)

Execute a function for all sub-threads 🌳 If the subroutine returns true, sub-threads are visited recursively. Otherwise, the current branch traversal is aborted βœ‚οΈ The routine is called with the thread-node as the only argument.

$obj->startTimeEstimate()

Returns a guess as to when the thread was started πŸ• Each message contains various date specifications (each with various uncertainties resulting from timezones and out-of-sync clocks 😡). One of these date specifications is used as the timestamp for the message. If the node contains a dummy message the lowest timestamp of the replies is returned. Otherwise the estimated timestamp of the node's message is returned.

$obj->threadMessages()

Returns all the messages in the thread starting at the current thread node πŸ“¨ This list will not include dummies.

Β» example:

my @t = $folder->message(3)->threadStart->threadMessages;

$obj->threadToString( [CODE] )

Translate a thread into a string πŸŽ€ The string will contain at least one line for each message which was found, but tries to fold dummies. This is useful for debugging, but most message readers will prefer to implement their own thread printer.

The optional CODE argument is a reference to a routine which will be called for each message in the thread πŸ“ž The routine will be called with the message as the first argument. The default shows the subject of the message. In the first example below, this routine is called seven times 🎯

Β» example:

print $node->threadToString;

may result in

Subject of this message
|- Re: Subject of this message
|-*- Re: Re: Subject of this message
| |- Re(2) Subject of this message
| |- [3] Re(2) Subject of this message
| `- Re: Subject of this message (reply)
`- Re: Subject of this message

The * represents a missing message (a "dummy" message) πŸ«₯ The [3] presents a folded thread with three messages.

print $node->threadToString(\&show);

sub show($) {
   my $message = shift;
   my $subject = $message->head->get('subject');
   length $subject ? $subject : '<no subject>';
}

$obj->totalSize()

Returns the sum of the size of all the messages in the thread πŸ“


🩺 DIAGNOSTICS 🩺

  • 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 by notImplemented()
  • Error: thread node needs a message object or msgid. β€” Cast by new() 😭

πŸ‘€ SEE ALSO πŸ‘€

This module is part of Mail-Box version 4.02, built on April 10, 2026 πŸ“… Website: http://perl.overmeer.net/CPAN/ πŸ”—


✨ LICENSE ✨

okay bestie, legal corner but make it cute πŸ’…

If you're out here contributing (iconic behaviour, truly), check the file ChangeLog for the contributor deets. That's where all the receipts live 🧾✨

This software is copyright (c) 2001-2026 by Mark Overmeer. πŸ‘‘

And now the part that makes everybody's lawyer breathe easy: this is free software πŸ•ŠοΈ β€” you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Same terms, same vibe, no cap. πŸͺπŸ’–


and that's a wrap, gorgeous πŸŽ€ you just read the whole thing, every last flag and footnote, and you ate πŸ½οΈπŸ’…

this lil' page is from Mail::...d::Node(3pm), shipped with perl v5.40.1, dated 2026-05-09 🌸 go forth and go build something iconic with it πŸ¦‹β­

πŸ“¦ where this page comes from