* [PATCH] wwwstream: improve documentation and variable naming
@ 2016-12-03 0:29 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-12-03 0:29 UTC (permalink / raw)
To: meta
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 {
).'</pre></body></html>';
}
+# 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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-03 0:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-03 0:29 [PATCH] wwwstream: improve documentation and variable naming Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).