1 # Copyright (C) 2016 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 package PublicInbox::MsgIter;
8 our @EXPORT = qw(msg_iter);
11 # Like Email::MIME::walk_parts, but this is:
13 # * passes depth and indices to the iterator callback
16 my @parts = $mime->subparts;
19 @parts = map { [ $_, 1, ++$i ] } @parts;
20 while (my $p = shift @parts) {
21 my ($part, $depth, @idx) = @$p;
22 my @sub = $part->subparts;
26 @sub = map { [ $_, $depth, @idx, ++$i ] } @sub;
27 @parts = (@sub, @parts);