]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/Thread.pm
workaround Mail::Thread memory leak
[public-inbox.git] / lib / PublicInbox / Thread.pm
1 # subclass Mail::Thread and use this to workaround a memory leak
2 # Based on the patch in: https://rt.cpan.org/Public/Bug/Display.html?id=22817
3 # License differs from the rest of public-inbox (but is compatible):
4 # This library is free software; you can redistribute it and/or modify
5 # it under the same terms as Perl itself.
6 package PublicInbox::Thread;
7 use strict;
8 use warnings;
9 use base qw(Mail::Thread);
10 sub _container_class { 'PublicInbox::Thread::Container' }
11
12 package PublicInbox::Thread::Container;
13 use strict;
14 use warnings;
15 use base qw(Mail::Thread::Container);
16 use Scalar::Util qw(weaken);
17 sub parent { @_ == 2 ? weaken($_[0]->{parent} = $_[1]) : $_[0]->{parent} }
18
19 1;