diff options
Diffstat (limited to 'lib/PublicInbox/NoopFilter.pm')
-rw-r--r-- | lib/PublicInbox/NoopFilter.pm | 19 |
1 files changed, 15 insertions, 4 deletions
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; |