{
    "mode": "perldoc",
    "parameter": "Mail::Box::Thread::Node",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3ABox%3A%3AThread%3A%3ANode/json",
    "generated": "2026-06-09T12:22:40Z",
    "synopsis": "my $node = Mail::Box::Thread::Node->new;\n$node->addMessage($message);\n...",
    "sections": {
        "NAME": {
            "content": "Mail::Box::Thread::Node - one node in a message thread\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "Mail::Box::Thread::Node\nis a Mail::Reporter\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $node = Mail::Box::Thread::Node->new;\n$node->addMessage($message);\n...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The \"Mail::Box::Thread::Node\" maintains one node in the linked list of threads. Each node\ncontains one message, and a list of its follow-ups. Next to that, it refers to its own ancestor\nand contains information about the trustworthiness of that relationship.\n\nTo complicate things a little, because the thread-manager can maintain multiple folders, and\nmerge there content, you may find the same message in more folders. All versions of the same\nmessage (based on message-id) are stored in the same node.\n\nExtends \"DESCRIPTION\" in Mail::Reporter.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Extends \"METHODS\" in Mail::Reporter.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Extends \"Constructors\" in Mail::Reporter.\n\nMail::Box::Thread::Node->new(%options)\nYou will not call this method yourself. The Mail::Box::Thread::Manager object will call it\nto construct \"Mail::Box::Thread::Node\" objects. Either a \"message\" or a \"messageId\" must be\nsupplied.\n\n-Option    --Defined in     --Default\ndummytype                   undef\nlog         Mail::Reporter   'WARNINGS'\nmessage                      undef\nmessageId                    undef\ntrace       Mail::Reporter   'WARNINGS'\n\ndummytype => CLASS\nIndicates the class name of dummy messages. Dummy messages are placeholders in a\nMail::Box::Thread::Manager data structure.\n\nlog => LEVEL\nmessage => MESSAGE\nThe MESSAGE which is stored in this node. The message must be a Mail::Box::Message.\n\nmessageId => MESSAGE-ID\nThe MESSAGE-ID for the message which is stored in this node. Only specify it when you\ndon't have the message yet.\n\ntrace => LEVEL\n"
                },
                {
                    "name": "The thread node",
                    "content": "$obj->addMessage($message)\nAdd one message to the thread node. If the node contains a dummy, then the dummy is\nreplaced. Otherwise, the messages is added to the end of the list.\n\n$obj->expand( [BOOLEAN] )\nReturns whether this (part of the) folder has to be shown expanded or not. This is simply\ndone by a label, which means that most folder types can store this.\n\n$obj->isDummy()\nReturns true if the message is a dummy. A dummy is a \"hole\" in a thread which has follow-ups\nbut does not have a message.\n\n$obj->message()\nGet the message which is stored in this thread node. NOTE: the same message may be located\nin many folders at the same time, and these folders may be controlled by the same thread\nmanager.\n\nIn scalar context, this method returns the first instance of the message that is not\ndeleted. If all instances are flagged for deletion, then you get the first deleted message.\nWhen the open folders only contain references to the message, but no instance, you get a\ndummy message (see Mail::Message::Dummy).\n\nIn list context, all instances of the message which have been found are returned.\n\nexample:\n\nmy $threads = $mgr->threads(folders => [$draft, $sent]);\nmy $node    = $draft->message(1)->thread;\n\nforeach my $instance ($node->message) {\nprint \"Found in \", $instance->folder, \".\\n\";\n}\n\nprint \"Subject is \", $node->message->subject, \".\\n\";\n\n$obj->messageId()\nReturn the message-id related to this thread node. Each of the messages listed in this node\nwill have the same ID.\n"
                },
                {
                    "name": "The thread order",
                    "content": "$obj->followUps()\nReturns the list of follow-ups to this thread node. This list may contain parsed,\nnot-parsed, and dummy messages.\n\n$obj->followedBy($threads)\nRegister that the $threads are follow-ups to this message. These follow-ups need not be\nrelated to each other in any way other than sharing the same parent.\n\nDefining the same relation more than once will not cause information to be duplicated.\n\n$obj->follows($thread, $quality)\nRegister that the current thread is a reply to the specified $thread. The $quality of the\nrelation is specified by the second argument. The method returns \"undef\" if the link is not\naccepted in order to avoid circular references.\n\nThe relation may be specified more than once, but only the most confident relation is used.\nFor example, if a reply ($quality equals \"REPLY\") is specified, later calls to the follow\nmethod will have no effect. If \"follows\" is called with a $quality that matches the current\nquality, the new thread overrides the previous.\n\n$obj->repliedTo()\nReturns the message(s) to which the message in this node replies. In scalar context, this\nmethod will return the message to which the message in this node replies. This message\nobject may be a dummy message.\n\nIf the message seems to be the first message of a thread, the value \"undef\" is returned.\n(Remember that some MUA are not adding reference information to the message's header, so you\ncan never be sure a message is the start of a thread)\n\nIn list context, this method returns a second string value indicating the confidence that\nthe messages are related. When extended thread discovery is enabled, then some heuristics\nare applied to determine if messages are related. Values for the STRING may be:\n\n*   'REPLY'\n\nThis relation was directly derived from an `in-reply-to' message header field. The\nrelation has a high confidence.\n\n*   'REFERENCE'\n\nThis relation is based on information found in a `Reference' message header field. One\nmessage may reference a list of messages which precede it in the thread. The heuristic\nattempts to determine relationships between messages assuming that the references are in\norder. This relation has a lower confidence.\n\n*   'GUESS'\n\nThe relation is a big guess, with low confidence. It may be based on a subject which\nseems to be related, or commonalities in the message's body.\n\nMore constants may be added later.\n\nexample:\n\nmy $question = $answer->repliedTo;\nmy ($question, $quality) = $answer->repliedTo;\nif($question && $quality eq 'REPLY') { ... };\n\n$obj->sortedFollowUps( [$prepare, [$compare]] )\nReturns the list of followUps(), but sorted. By default sorting is based on the estimated\ntime of the reply. See startTimeEstimate().\n"
                },
                {
                    "name": "On the whole thread",
                    "content": "Some convenience methods are added to threads, to simplify retrieving information from it.\n\n$obj->endTimeEstimate()\nReturns a guess as to when the thread has ended (although you never know for sure whether\nthere fill follow messages in the future).\n\n$obj->ids()\nReturns all the ids in the thread starting at the current thread node.\n\nexample:\n\n$newfolder->addMessages($folder->ids($thread->ids));\n$folder->delete($thread->ids);\n\n$obj->numberOfMessages()\nNumber of messages in the thread starting at the current thread node, but not counting the\ndummies.\n\n$obj->recurse(CODE)\nExecute a function for all sub-threads. If the subroutine returns true, sub-threads are\nvisited recursively. Otherwise, the current branch traversal is aborted. The routine is\ncalled with the thread-node as the only argument.\n\n$obj->startTimeEstimate()\nReturns a guess as to when the thread was started. Each message contains various date\nspecifications (each with various uncertainties resulting from timezones and out-of-sync\nclocks). One of these date specifications is used as the timestamp for the message. If the\nnode contains a dummy message the lowest timestamp of the replies is returned. Otherwise the\nestimated timestamp of the node's message is returned.\n\n$obj->threadMessages()\nReturns all the messages in the thread starting at the current thread node. This list will\nnot include dummies.\n\nexample:\n\nmy @t = $folder->message(3)\n->threadStart\n->threadMessages;\n\n$obj->threadToString( [CODE] )\nTranslate a thread into a string. The string will contain at least one line for each message\nwhich was found, but tries to fold dummies. This is useful for debugging, but most message\nreaders will prefer to implement their own thread printer.\n\nThe optional CODE argument is a reference to a routine which will be called for each message\nin the thread. The routine will be called with the message as the first argument. The\ndefault shows the subject of the message. In the first example below, this routine is called\nseven times.\n\nexample:\n\nprint $node->threadToString;\n\nmay result in\n\nSubject of this message\n|- Re: Subject of this message\n|-*- Re: Re: Subject of this message\n| |- Re(2) Subject of this message\n| |- [3] Re(2) Subject of this message\n| `- Re: Subject of this message (reply)\n`- Re: Subject of this message\n\nThe `*' represents a missing message (a \"dummy\" message). The `[3]' presents a folded thread\nwith three messages.\n\nprint $node->threadToString(\\&show);\n\nsub show($) {\nmy $message = shift;\nmy $subject = $message->head->get('subject');\nlength $subject ? $subject : '<no subject>';\n}\n\n$obj->totalSize()\nReturns the sum of the size of all the messages in the thread.\n"
                },
                {
                    "name": "Error handling",
                    "content": "Extends \"Error handling\" in Mail::Reporter.\n\n$obj->AUTOLOAD()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->addReport($object)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nMail::Box::Thread::Node->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->errors()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->log( [$level, [$strings]] )\nMail::Box::Thread::Node->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Box::Thread::Node->logPriority($level)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logSettings()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->notImplemented()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->report( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->reportAll( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->trace( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->warnings()\nInherited, see \"Error handling\" in Mail::Reporter\n"
                },
                {
                    "name": "Cleanup",
                    "content": "Extends \"Cleanup\" in Mail::Reporter.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n"
                }
            ]
        },
        "DIAGNOSTICS": {
            "content": "Error: Package $package does not implement $method.\nFatal error: the specific package (or one of its superclasses) does not implement this\nmethod where it should. This message means that some other related classes do implement this\nmethod however the class at hand does not. Probably you should investigate this and probably\ninform the author of the package.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "This module is part of Mail-Box distribution version 3.009, built on August 18, 2020. Website:\nhttp://perl.overmeer.net/CPAN/\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyrights 2001-2020 by [Mark Overmeer]. For other contributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://dev.perl.org/licenses/\n",
            "subsections": []
        }
    },
    "summary": "Mail::Box::Thread::Node - one node in a message thread",
    "flags": [],
    "examples": [],
    "see_also": []
}