diff options
author | Eric Wong <e@80x24.org> | 2019-12-28 21:43:17 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-12-28 21:43:17 +0000 |
commit | 65e3cc8f6cc73e45db827cbeee4ccecbf1502496 (patch) | |
tree | c7575754de71f56b92b9ac808cc3d675f374fef2 /lib/PublicInbox/GetlineBody.pm | |
parent | ac1ac3b4e2858bcee5a644aac8b6320422ea7383 (diff) | |
parent | f2364c5765f0692d2f1e82b61804359a38f3fdfc (diff) | |
download | public-inbox-65e3cc8f6cc73e45db827cbeee4ccecbf1502496.tar.gz |
* no-closure: (30 commits) search: retry_reopen passes user arg to callback solvergit: allow passing arg to user-supplied callback viewvcs: avoid anonymous sub for HTML response wwwattach: avoid anonymous sub for msg_iter view: msg_iter calls add_body_text directly searchview: remove anonymous sub when sorting threads by relevance view: thread_html: pass named sub to WwwStream searchview: pass named subs to Www*Stream wwwtext: avoid anonymous sub in response contentid: no anonymous sub view: msg_html: stop using an anonymous sub view: avoid anon sub in stream_thread config: each_inbox: pass user arg to callback feed: avoid anonymous subs mboxgz: pass $ctx to callback to avoid anon subs www: lazy load Plack::Util githttpbackend: split out wwwstatic qspawn: psgi_return: allow non-anon parse_hdr callback qspawn: drop "qspawn.filter" support, for now qspawn: psgi_qx: eliminate anonymous subs ...
Diffstat (limited to 'lib/PublicInbox/GetlineBody.pm')
-rw-r--r-- | lib/PublicInbox/GetlineBody.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/PublicInbox/GetlineBody.pm b/lib/PublicInbox/GetlineBody.pm index f8cdd1b7..bcabc04a 100644 --- a/lib/PublicInbox/GetlineBody.pm +++ b/lib/PublicInbox/GetlineBody.pm @@ -13,12 +13,13 @@ use strict; use warnings; sub new { - my ($class, $rpipe, $end, $buf, $filter) = @_; + my ($class, $rpipe, $end, $end_arg, $buf) = @_; bless { rpipe => $rpipe, end => $end, + end_arg => $end_arg, buf => $buf, - filter => $filter || 0, + filter => 0, }, $class; } @@ -35,15 +36,14 @@ sub getline { my $buf = delete $self->{buf}; # initial buffer $buf = $self->{rpipe}->getline unless defined $buf; $self->{filter} = -1 unless defined $buf; # set EOF for next call - $filter ? $filter->($buf) : $buf; + $buf; } sub close { my ($self) = @_; - my $rpipe = delete $self->{rpipe}; + my ($rpipe, $end, $end_arg) = delete @$self{qw(rpipe end end_arg)}; close $rpipe if $rpipe; - my $end = delete $self->{end}; - $end->() if $end; + $end->($end_arg) if $end; } 1; |