]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/LeiFinmsg.pm
imap+nntp: share COMPRESS implementation
[public-inbox.git] / lib / PublicInbox / LeiFinmsg.pm
1 # Copyright (C) all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # Finalization messages, used to queue up a bunch of messages which
5 # only get written out on ->DESTROY
6 package PublicInbox::LeiFinmsg;
7 use strict;
8 use v5.10.1;
9
10 sub new {
11         my ($cls, $lei) = @_;
12         bless [ @$lei{qw(2 sock)}, $$ ], $cls;
13 }
14
15 sub DESTROY {
16         my ($self) = @_;
17         my ($stderr, $sock, $pid) = splice(@$self, 0, 3);
18         print $stderr @$self if $pid == $$;
19         # script/lei disconnects when $sock SvREFCNT drops to zero
20 }
21
22 1;