From e0e53f21b15d40841f184f22223896cf7cf0b8d8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 25 Dec 2019 07:50:40 +0000 Subject: msg_iter: provide means to stop using anonymous subs And remove the last anonymous sub in SolverGit itself. --- lib/PublicInbox/MsgIter.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/MsgIter.pm') diff --git a/lib/PublicInbox/MsgIter.pm b/lib/PublicInbox/MsgIter.pm index 6453d9f1..cdd78b39 100644 --- a/lib/PublicInbox/MsgIter.pm +++ b/lib/PublicInbox/MsgIter.pm @@ -12,8 +12,8 @@ use PublicInbox::MIME; # Like Email::MIME::walk_parts, but this is: # * non-recursive # * passes depth and indices to the iterator callback -sub msg_iter ($$) { - my ($mime, $cb) = @_; +sub msg_iter ($$;$) { + my ($mime, $cb, $cb_arg) = @_; my @parts = $mime->subparts; if (@parts) { my $i = 0; @@ -27,11 +27,11 @@ sub msg_iter ($$) { @sub = map { [ $_, $depth, @idx, ++$i ] } @sub; @parts = (@sub, @parts); } else { - $cb->($p); + $cb->($p, $cb_arg); } } } else { - $cb->([$mime, 0, 0]); + $cb->([$mime, 0, 0], $cb_arg); } } -- cgit v1.2.3-24-ge0c7