diff options
author | Eric Wong <e@80x24.org> | 2019-12-25 07:50:39 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-12-26 10:48:19 +0000 |
commit | dd57a7d007bf756d856fe3d2b414657ebf009941 (patch) | |
tree | 9b68c7531d1c50b7750c26eccd48c0c79b88cb4a /lib/PublicInbox/GetlineBody.pm | |
parent | 5c887bfc4ccc6fd79e29d89ee8edfccd5cd9685b (diff) | |
download | public-inbox-dd57a7d007bf756d856fe3d2b414657ebf009941.tar.gz |
This will tie into the DS event loop if that's used, but event_step an be called directly without relying on the event loop from Apache or other HTTP servers (or PSGI tests).
Diffstat (limited to 'lib/PublicInbox/GetlineBody.pm')
-rw-r--r-- | lib/PublicInbox/GetlineBody.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/GetlineBody.pm b/lib/PublicInbox/GetlineBody.pm index f8cdd1b7..750a8c53 100644 --- a/lib/PublicInbox/GetlineBody.pm +++ b/lib/PublicInbox/GetlineBody.pm @@ -13,10 +13,11 @@ use strict; use warnings; sub new { - my ($class, $rpipe, $end, $buf, $filter) = @_; + my ($class, $rpipe, $end, $end_arg, $buf, $filter) = @_; bless { rpipe => $rpipe, end => $end, + end_arg => $end_arg, buf => $buf, filter => $filter || 0, }, $class; @@ -40,10 +41,9 @@ sub getline { 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; |