From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 42DEC1F453 for ; Wed, 6 Feb 2019 10:33:21 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] http: cleanup partial-write handling on readonly values Date: Wed, 6 Feb 2019 10:33:21 +0000 Message-Id: <20190206103321.18006-1-e@80x24.org> List-Id: Don't bother assigning to $_[1]; just let Danga::Socket do its thing since $_[1] should be out-of-scope soon. --- lib/PublicInbox/HTTP.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index bc10814..9657b31 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -318,11 +318,9 @@ sub more ($$) { if (defined $n) { my $nlen = length($_[1]) - $n; return 1 if $nlen == 0; # all done! - eval { $_[1] = substr($_[1], $n, $nlen) }; - if ($@) { # modification of read-only value: - return $self->write(substr($_[1], $n, $nlen)); - } - # fall through to normal write: + + # Danga::Socket::write queues the unwritten substring: + return $self->write(substr($_[1], $n, $nlen)); } } $self->write($_[1]); -- EW