You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2011/10/28 22:57:44 UTC

svn commit: r1190565 - in /spamassassin/trunk/lib/Mail: SpamAssassin.pm SpamAssassin/Message.pm

Author: mmartinec
Date: Fri Oct 28 20:57:44 2011
New Revision: 1190565

URL: http://svn.apache.org/viewvc?rev=1190565&view=rev
Log:
Bug 6686: Allow Mail::SpamAssassin::parser to accept $message also as a string ref, saves a copy and memory

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin.pm?rev=1190565&r1=1190564&r2=1190565&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin.pm Fri Oct 28 20:57:44 2011
@@ -460,11 +460,13 @@ sub create_locker {
 
 Parse will return a Mail::SpamAssassin::Message object with just the
 headers parsed.  When calling this function, there are two optional
-parameters that can be passed in: $message is either undef (which will
-use STDIN), a scalar of the entire message, an array reference of the
-message with 1 line per array element, or a file glob which holds the
-entire contents of the message; and $parse_now, which specifies whether
-or not to create the MIME tree at parse time or later as necessary.
+parameters that can be passed in: $message is either undef (which
+will use STDIN), a scalar - a string containing an entire message,
+a reference to such string, an array reference of the message with
+one line per array element, or either a file glob or an IO::File object
+which holds the entire contents of the message;  and $parse_now, which
+specifies whether or not to create a MIME tree at parse time or later
+as necessary.
 
 The I<$parse_now> option, by default, is set to false (0).  This
 allows SpamAssassin to not have to generate the tree of internal

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm?rev=1190565&r1=1190564&r2=1190565&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm Fri Oct 28 20:57:44 2011
@@ -63,10 +63,10 @@ use vars qw(@ISA);
 Creates a Mail::SpamAssassin::Message object.  Takes a hash reference
 as a parameter.  The used hash key/value pairs are as follows:
 
-C<message> is either undef (which will use STDIN), a scalar of the
-entire message, an array reference of the message with 1 line per array
-element, and either a file glob or IO::File object which holds the entire
-contents of the message.
+C<message> is either undef (which will use STDIN), a scalar - a string
+containing an entire message, a reference to such string, an array reference
+of the message with one line per array element, or either a file glob
+or an IO::File object which holds the entire contents of the message.
 
 Note: The message is expected to generally be in RFC 2822 format, optionally
 including an mbox message separator line (the "From " line) as the first line.
@@ -156,6 +156,9 @@ sub new {
       }
     }
   }
+  elsif (ref $message eq 'SCALAR') {
+    @message = split(/^/m, $$message, -1);
+  }
   elsif (ref $message) {
     dbg("message: Input is a reference of unknown type!");
   }