From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C76B01FC96 for ; Sat, 3 Dec 2016 00:29:12 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] wwwstream: improve documentation and variable naming Date: Sat, 3 Dec 2016 00:29:12 +0000 Message-Id: <20161203002912.18199-1-e@80x24.org> List-Id: Hopefully this makes the code more readable for newbies. --- lib/PublicInbox/WwwStream.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index 12f5fa5..01f7b31 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -12,6 +12,7 @@ our $TOR2WEB_URL = 'https://www.tor2web.org/'; our $CODE_URL = 'https://public-inbox.org/'; our $PROJECT = 'public-inbox'; +# noop for HTTP.pm (and any other PSGI servers) sub close {} sub new { @@ -111,14 +112,15 @@ sub _html_end { ).''; } +# callback for HTTP.pm (and any other PSGI servers) sub getline { my ($self) = @_; my $nr = $self->{nr}++; return _html_top($self) if $nr == 0; - if (my $mid = $self->{cb}) { # middle - $mid = $mid->($nr, $self->{ctx}) and return $mid; + if (my $middle = $self->{cb}) { + $middle = $middle->($nr, $self->{ctx}) and return $middle; } delete $self->{cb} ? _html_end($self) : undef; -- EW