]> Sergey Matveev's repositories - public-inbox.git/commitdiff
public-inbox-learn: drop leading "From " line from mboxes
authorEric Wong <e@80x24.org>
Sat, 9 Apr 2016 01:27:37 +0000 (01:27 +0000)
committerEric Wong <e@80x24.org>
Sat, 9 Apr 2016 01:27:37 +0000 (01:27 +0000)
It can confuse Email::MIME if we have it.

script/public-inbox-learn

index 0c7b4199abeea2def7b452101ce83e4e24b9b7a1..81675d0295e320057b8c1ded2dcc925f868e3f8a 100755 (executable)
@@ -17,7 +17,12 @@ if ($train !~ /\A(?:ham|spam)\z/) {
 }
 
 my $pi_config = PublicInbox::Config->new;
-my $mime = Email::MIME->new(eval { local $/; <> });
+my $mime = Email::MIME->new(eval {
+       local $/;
+       my $data = scalar <STDIN>;
+       $data =~ s/\AFrom [^\r\n]*\r?\n//s;
+       $data
+});
 
 # get all recipients
 my %dests;