]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
input_pipe: {args} is never undefined
authorEric Wong <e@80x24.org>
Wed, 4 Oct 2023 03:49:18 +0000 (03:49 +0000)
committerEric Wong <e@80x24.org>
Wed, 4 Oct 2023 17:46:34 +0000 (17:46 +0000)
So save us a few ugly defined-ness checks.

lib/PublicInbox/InputPipe.pm

index e1e26e20b9d287ba779bd6f32a9ad81c8f8a06d9..60a9f01f8fba69d55fe35247cbbe5ca8263370a5 100644 (file)
@@ -1,10 +1,9 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # for reading pipes and sockets off the DS event loop
 package PublicInbox::InputPipe;
-use strict;
-use v5.10.1;
+use v5.12;
 use parent qw(PublicInbox::DS);
 use PublicInbox::Syscall qw(EPOLLIN EPOLLET);
 
@@ -20,15 +19,15 @@ sub event_step {
        my ($self) = @_;
        my $r = sysread($self->{sock} // return, my $rbuf, 65536);
        if ($r) {
-               $self->{cb}->(@{$self->{args} // []}, $rbuf);
+               $self->{cb}->(@{$self->{args}}, $rbuf);
                return $self->requeue; # may be regular file or pipe
        }
        if (defined($r)) { # EOF
-               $self->{cb}->(@{$self->{args} // []}, '');
+               $self->{cb}->(@{$self->{args}}, '');
        } elsif ($!{EAGAIN}) {
                return;
        } else { # another error
-               $self->{cb}->(@{$self->{args} // []}, undef)
+               $self->{cb}->(@{$self->{args}}, undef)
        }
        $self->{sock}->blocking ? delete($self->{sock}) : $self->close
 }