]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-learn
introduce PublicInbox::MIME wrapper class
[public-inbox.git] / script / public-inbox-learn
index 09fd7c8f43409865471acbe481a82ad149b43ebd..a696d348bd5cfc519a02cbb2c383672208a145ef 100755 (executable)
@@ -10,7 +10,7 @@ use warnings;
 use PublicInbox::Config;
 use PublicInbox::Git;
 use PublicInbox::Import;
-use Email::MIME;
+use PublicInbox::MIME;
 use Email::MIME::ContentType;
 $Email::MIME::ContentType::STRICT_PARAMS = 0; # user input is imperfect
 use PublicInbox::Address;
@@ -23,7 +23,7 @@ if ($train !~ /\A(?:ham|spam)\z/) {
 my $spamc = PublicInbox::Spamcheck::Spamc->new;
 my $pi_config = PublicInbox::Config->new;
 my $err;
-my $mime = Email::MIME->new(eval {
+my $mime = PublicInbox::MIME->new(eval {
        local $/;
        my $data = scalar <STDIN>;
        $data =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
@@ -57,7 +57,7 @@ foreach my $recipient (keys %dests) {
        my $git = PublicInbox::Git->new($git_dir);
        # We do not touch GIT_COMMITTER_* env here so we can track
        # who trained the message.
-       my $name = $ENV{GIT_COMMITTER_NAME} || $dst->{inbox};
+       my $name = $ENV{GIT_COMMITTER_NAME} || $dst->{name};
        my $email = $ENV{GIT_COMMITTER_EMAIL} || $recipient;
        my $im = PublicInbox::Import->new($git, $name, $email);