Skip Menu |

This queue is for tickets about the Mail-Thread CPAN distribution.

Report information
The Basics
Id: 31990
Status: new
Priority: 0/
Queue: Mail-Thread

Owner: Nobody in particular
Requestors: whynot [...]

Bug Information
Severity: Normal
Broken in: 2.41
Fixed in: (no value)

Subject: Mail::Thread hardly violates perlstyle, unbearable
Download (untitled) / with headers
text/plain 302b
Yes, I know. perlstyle (v.5.8.8) in the 3rd chapter from the bottom, B<just> recommends documenting code, but... Sir! That's unfair, first of all, to hide useful (and sometime critically useful) APIs behind curtains of C<__END__> (looking from the user's POV, the actual code is behind C<__END__>).
Subject: bugfix
Download bugfix
text/plain 1.8k
diff -ur Mail-Thread-2.55.orig/ Mail-Thread-2.55/ --- Mail-Thread-2.55.orig/ 2006-10-30 10:50:26.000000000 +0200 +++ Mail-Thread-2.55/ 2007-12-29 22:33:21.000000000 +0200 @@ -541,6 +541,18 @@ Goes away and threads the messages together. +=over + +=item C<$Mail::Thread::noprune> + +Setting will prevent pruning empty (with no real message attached) nodes. + +=item C<$Mail::Thread::nosubject> + +Recovering threads based on C<Subject:> headers will be disabled. + +=back + =head2 rootset Returns a list of C<Mail::Thread::Container>s which are not the parents @@ -640,6 +652,31 @@ Calls the given callback on this node and B<all> of its children. +=head2 iterate_down($before, $after) + +That iterates depth-first through the thread. +Before any move C<$before> callback is invoked with the current node and the depth as parameters. +After iteration completes (that's not recursive iteration) C<$after> callback is invoked for B<all> nodes that have been found; +The depth is passed to C<$after> as a second parameter. + + # both arrays will be equal (w/ sorting left as an exercise) + # (actually, they'll be equal w/o sorting) + my(@one, @two); + $thread->iterate_down(sub { push(@one, shift(@_)->messageid(); }, undef); + $thread->iterate_down(undef, sub { push(@two, shift(@_)->messageid(); }); + + # that will taint all the thread, if any threaded mail has evil word + my $redflag; + $thread->iterate_down( + sub { + my $x = shift; + $x->message or return; + $x->message->get_body =~ m/\bbasic\b/i and $redflag++; }, + sub { + my $x = shift; + $x->message or return; + $redflag and $x->message->set_header('X-Spam-Status' => 25);}) + =head1 DEBUGGING You can set $Mail::Thread::debug=1 to watch what's going on.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to