]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/HTTP.pm
ds|http|nntp: simplify {wbuf} population
[public-inbox.git] / lib / PublicInbox / HTTP.pm
index 071251c632e394302097538bf86ed881473a6fe5..325371535995ce0a343277bd6fcc603f2cc9493b 100644 (file)
@@ -280,12 +280,12 @@ sub getline_pull {
                }
 
                if ($self->{sock}) {
-                       my $wbuf = $self->{wbuf} //= [];
-                       push @$wbuf, \&getline_pull;
+                       # autovivify wbuf
+                       my $new_size = push(@{$self->{wbuf}}, \&getline_pull);
 
                        # wbuf may be populated by {chunked,identity}_write()
                        # above, no need to rearm if so:
-                       $self->requeue if scalar(@$wbuf) == 1;
+                       $self->requeue if $new_size == 1;
                        return; # likely
                }
        } elsif ($@) {