about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/GzipFilter.pm2
-rw-r--r--lib/PublicInbox/NoopFilter.pm19
-rw-r--r--lib/PublicInbox/WwwListing.pm8
3 files changed, 20 insertions, 9 deletions
diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm
index d2eb4e66..0fbb4476 100644
--- a/lib/PublicInbox/GzipFilter.pm
+++ b/lib/PublicInbox/GzipFilter.pm
@@ -73,7 +73,7 @@ sub zmore {
         my $self = $_[0]; # $_[1] => input
         my $err = $self->{gz}->deflate($_[1], $self->{zbuf});
         die "gzip->deflate: $err" if $err != Z_OK;
-        '';
+        undef;
 }
 
 # flushes and returns the final bit of gzipped data
diff --git a/lib/PublicInbox/NoopFilter.pm b/lib/PublicInbox/NoopFilter.pm
index b9c00ff7..a97dbde6 100644
--- a/lib/PublicInbox/NoopFilter.pm
+++ b/lib/PublicInbox/NoopFilter.pm
@@ -4,10 +4,21 @@
 package PublicInbox::NoopFilter;
 use strict;
 
-sub new { bless \(my $ignore), __PACKAGE__ }
+sub new { bless \(my $self = ''), __PACKAGE__ }
 
 # noop workalike for PublicInbox::GzipFilter methods
-sub translate { $_[1] // '' }
-sub zmore { $_[1] }
-sub zflush { $_[1] // '' }
+sub translate {
+        my $self = $_[0];
+        my $ret = $$self .= ($_[1] // '');
+        $$self = '';
+        $ret;
+}
+
+sub zmore {
+        ${$_[0]} .= $_[1];
+        undef;
+}
+
+sub zflush { translate($_[0], $_[1]) }
+
 1;
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index 780c97e9..d641e6d5 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -109,7 +109,7 @@ sub html ($$) {
         my $h = [ 'Content-Type', 'text/html; charset=UTF-8',
                         'Content-Length', undef ];
         my $gzf = gzf_maybe($h, $env) || PublicInbox::NoopFilter::new();
-        my $out = $gzf->zmore('<html><head><title>' .
+        $gzf->zmore('<html><head><title>' .
                                 'public-inbox listing</title>' .
                                 '</head><body><pre>');
         my $code = 404;
@@ -122,11 +122,11 @@ sub html ($$) {
 
                 my $tmp = join("\n", map { ibx_entry(@$_, $env) } @$list);
                 my $l = PublicInbox::Linkify->new;
-                $out .= $gzf->zmore($l->to_html($tmp));
+                $gzf->zmore($l->to_html($tmp));
         } else {
-                $out .= $gzf->zmore('no inboxes, yet');
+                $gzf->zmore('no inboxes, yet');
         }
-        $out .= $gzf->zflush('</pre><hr><pre>'.
+        my $out = $gzf->zflush('</pre><hr><pre>'.
                                 PublicInbox::WwwStream::code_footer($env) .
                                 '</pre></body></html>');
         $h->[3] = bytes::length($out);