]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiFinmsg.pm
No ext_urls
[public-inbox.git] / lib / PublicInbox / LeiFinmsg.pm
index 395e7d3c7083037b4fbf6e62c67265e09c9b6685..7ed58c247696e5c044f0725b8696c5ca562aa753 100644 (file)
@@ -8,14 +8,15 @@ use strict;
 use v5.10.1;
 
 sub new {
-       my ($cls, $io) = @_;
-       bless [ $io, $$ ], $cls;
+       my ($cls, $lei) = @_;
+       bless [ @$lei{qw(2 sock)}, $$ ], $cls;
 }
 
 sub DESTROY {
        my ($self) = @_;
-       my $io = shift @$self;
-       shift(@$self) == $$ and print $io @$self;
+       my ($stderr, $sock, $pid) = splice(@$self, 0, 3);
+       print $stderr @$self if $pid == $$;
+       # script/lei disconnects when $sock SvREFCNT drops to zero
 }
 
 1;