- my $in_fmt = $lei->{opt}->{'in-format'};
- my $mics;
- if (my $stdin = delete $self->{0}) {
- convert_fh($self, $in_fmt, $stdin, '<stdin>');
- }
- for my $input (@{$self->{inputs}}) {
- my $ifmt = lc($in_fmt // '');
- if ($input =~ m!\Aimaps?://!) {
- $lei->{net}->imap_each($input, \&net_cb, $self);
- next;
- } elsif ($input =~ m!\A(?:nntps?|s?news)://!) {
- $lei->{net}->nntp_each($input, \&net_cb, $self);
- next;
- } elsif ($input =~ s!\A([a-z0-9]+):!!i) {
- $ifmt = lc $1;
- }
- if (-f $input) {
- my $m = $lei->{opt}->{'lock'} //
- ($ifmt eq 'eml' ? ['none'] :
- PublicInbox::MboxLock->defaults);
- my $mbl = PublicInbox::MboxLock->acq($input, 0, $m);
- convert_fh($self, $ifmt, $mbl->{fh}, $input);
- } elsif (-d _) {
- PublicInbox::MdirReader::maildir_each_eml($input,
- \&mdir_cb, $self);
- } else {
- die "BUG: $input unhandled"; # should've failed earlier
- }
- }