]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
Just read headers on insert
authorIan Campbell <ijc@hellion.org.uk>
Mon, 29 Oct 2012 11:15:38 +0000 (12:15 +0100)
committerIan Campbell <ijc@hellion.org.uk>
Mon, 29 Oct 2012 11:15:38 +0000 (12:15 +0100)
insertmail.pl

index 4898cb8e294a6c5684e7ebbb2d76c9f543d8aff1..5535718260dce5cb5617b9fdaf3d73371ee16dcf 100755 (executable)
@@ -11,10 +11,15 @@ use DBI;
 
 use Bugs::Message;
 
-our @msg = <STDIN>;
-our $raw = join("",@msg);
+our @hdrs;
 
-our $head = Mail::Header->new( \@msg );
+while (<STDIN>) {
+    last if m/^$/;
+
+    push @hdrs, $_;
+}
+
+our $head = Mail::Header->new( \@hdrs );
 
 $head->unfold();
 
@@ -22,4 +27,6 @@ our $dbh = DBI->connect("dbi:SQLite:dbname=/tmp/bugs.sqlite","","");
 $dbh->{AutoCommit} = 1;
 
 our $msg = Bugs::Message->insert($dbh, $head);
-#print "\n";
+
+# XXX save $raw and body (remainder of <STDIN>)
+#our $raw = join("",@hdrs);