Debian Codegraph @

README

raw
1 NAME
2 Mail::Thread - Perl implementation of JWZ's mail threading algorithm
3
4 SYNOPSIS
5 use Mail::Thread;
6 my $threader = new Mail::Thread (@messages);
7
8 $threader->thread;
9
10 dump_em($_,0) for $threader->rootset;
11
12 sub dump_em {
13 my ($self, $level) = @_;
14 print (' \\-> ' x $level);
15 if ($self->message) {
16 print $self->message->head->get("Subject") , "\n";
17 } else {
18 print "[ Message $self not available ]\n";
19 }
20 dump_em($self->next, $level) if $self->next;
21 dump_em($self->child, $level+1) if $self->child;
22 }
23
24 DESCRIPTION
25 This module implements something relatively close to Jamie Zawinski's
26 mail threading algorithm, as described by
27 http://www.jwz.org/doc/threading.html. Any deviations from the algorithm
28 are accidental.
29
30 It doesn't do threading by subject yet, because I don't need it yet.
31
32 It's happy to be handed "Mail::Internet" and "Mail::Box::Message"
33 objects, since they're more or less the same, but nothing other than
34 that.
35
36 METHODS
37 new(@messages)
38 Creates a new threader; requires a bunch of messages to thread.
39
40 thread
41 Goes away and threads the messages together.
42
43 rootset
44 Returns a list of "Mail::Thread::Container"s which are not the parents
45 of any other message.
46
47 "Mail::Thread::Container" methods
48 "Mail::Thread::Container"s are the nodes of the thread tree. You can't
49 just have the ordinary messages, because we might not have the message
50 in question. For instance, a mailbox could contain two replies to a
51 question that we haven't received yet. So all "logical" messages are
52 stuffed in containers, whether we happen to have that container or not.
53
54 To do anything useful with the thread tree, you're going to have to
55 recurse around the list of "Mail::Thread::Containers". You do this with
56 the following methods:
57
58 parent
59 child
60 next
61 Returns the container which is the parent, child or immediate sibling of
62 this one, if one exists.
63
64 message
65 Returns the message held in this container, if we have one.
66
67 id
68 Returns the message ID for this container. This will be around whether
69 we have the message or not, since some other message will have referred
70 to it by message ID.
71
72 find_child($child)
73 Returns true if this container has the given container as a child
74 somewhere beneath it.
75
76 children
77 Returns a list of the immediate children of this container.
78
79 recurse_down($callback)
80 Calls the given callback on this node and all of its children.
81
82 AUTHOR
83 Simon Cozens, <[email protected]>
84
85 COPYRIGHT AND LICENSE
86 Copyright 2003 by Kasei
87
88 This library is free software; you can redistribute it and/or modify it
89 under the same terms as Perl itself.
90