use PublicInbox::MDA;
use PublicInbox::Address;
use Encode qw/encode/;
- my $eml = 't/utf8.eml';
- my $msg = PublicInbox::InboxWritable::mime_from_path($eml) or
- die "failed to open $eml: $!";
+ my $msg = mime_load 't/utf8.eml';
my $from = $msg->header('From');
my ($author) = PublicInbox::Address::names($from);
my ($email) = PublicInbox::Address::emails($from);
use Test::More;
use PublicInbox::TestCommon;
use PublicInbox::Hval qw(ascii_html);
-use PublicInbox::InboxWritable;
use_ok('PublicInbox::MsgIter');
{
}
{
- my $f = 't/iso-2202-jp.eml';
- my $mime = PublicInbox::InboxWritable::mime_from_path($f) or
- die "open $f: $!";
+ my $mime = mime_load 't/iso-2202-jp.eml';
my $raw = '';
msg_iter($mime, sub {
my ($part, $level, @ex) = @{$_[0]};
}
{
- my $f = 't/x-unknown-alpine.eml';
- my $mime = PublicInbox::InboxWritable::mime_from_path($f) or
- die "open $f: $!";
+ my $mime = mime_load 't/x-unknown-alpine.eml';
my $raw = '';
msg_iter($mime, sub {
my ($part, $level, @ex) = @{$_[0]};
{
my $im = $ibx->importer(0);
- my $eml = 't/data/0001.patch';
- my $mime = PublicInbox::InboxWritable::mime_from_path($eml) or
- die "open $eml: $!";
+ my $mime = mime_load 't/data/0001.patch';
ok($im->add($mime), 'message added');
$im->done;
if ($version == 1) {
});
$ibx->with_umask(sub {
- my $eml = 't/utf8.eml';
- my $mime = PublicInbox::InboxWritable::mime_from_path($eml) or
- die "open $eml: $!";
+ my $mime = mime_load 't/utf8.eml';
my $doc_id = $rw->add_message($mime);
ok($doc_id > 0, 'message indexed doc_id with UTF-8');
my $msg = $rw->query('m:testmessage@example.com', {limit => 1})->[0];
$im->{parallel} = 0;
my $deliver_patch = sub ($) {
- my $mime = PublicInbox::InboxWritable::mime_from_path($_[0]) or
- die "open $_[0]: $!";
- $im->add($mime);
+ $im->add(mime_load($_[0]));
$im->done;
};