-
- my $self = fields::new($class);
- IO::Handle::blocking($io, 0);
- $self->SUPER::new($io, EPOLLIN | EPOLLET);
- $self->{cb} = $cb; # initial read callback
- $self->{arg} = $arg; # arg for $cb
- $self->{end_obj} = $end_obj; # like END{}, can ->event_step
- $self;
+ my $self = bless {
+ cb => $cb, # initial read callback
+ arg => $arg, # arg for $cb
+ end_obj => $end_obj, # like END{}, can ->event_step
+ }, $class;
+ my $pp = tied *$io; # ProcessPipe
+ $pp->{fh}->blocking(0) // die "$io->blocking(0): $!";
+ $self->SUPER::new($io, EPOLLIN);