]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/ParentPipe.pm
update copyrights for 2018
[public-inbox.git] / lib / PublicInbox / ParentPipe.pm
1 # Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 # only for PublicInbox::Daemon
4 package PublicInbox::ParentPipe;
5 use strict;
6 use warnings;
7 use base qw(Danga::Socket);
8 use fields qw(cb);
9
10 sub new ($$$) {
11         my ($class, $pipe, $cb) = @_;
12         my $self = fields::new($class);
13         $self->SUPER::new($pipe);
14         $self->{cb} = $cb;
15         $self->watch_read(1);
16         $self;
17 }
18
19 sub event_read { $_[0]->{cb}->($_[0]) }
20
21 1;