On Wed, Sep 29, 2004 at 03:32:22PM -0500, Bob Apthorpe wrote:
> If I wanted to analyzed a message using either SA 2.6x or 3.x, what do I
> use to encapsulate that message aside from
> Mail::SpamAssassin::NoMailAudit? That is, how do I have to change:
> 
> ----
>         $self->{'_mail'} = Mail::SpamAssassin::NoMailAudit->new();
> 
>         # Make a M::SA object; point to custom configs
>         my $spamtest = Mail::SpamAssassin->new($self->{'sa_prefs'});
> 
>         # Get verdict, score, list of rules
>         my $status = $spamtest->check($self->{'_mail'});
> ----
> 
> so that it'll work with both SA 2.6x and 3.x?

the top of the M::SA docs have it pretty clear:

         my $spamtest = Mail::SpamAssassin->new();
         my $mail = $spamtest->parse( $message );
         my $status = $spamtest->check( $mail );

We decided to change the API to just call parse() which will return the
appropriate object instead of calling NoMailAudit (or in 3.0, Message,) and
doing it yourself (although you can do that, the parse() method lets us change
things on the backend without having to change the published API).

So in theory, you could figure out what version you're on, then do an if/else
to call NMA or parse() appropriately.

-- 
Randomly Generated Tagline:
"Yeah ... You can give pilots guns ... or here's an idea: Why don't you
 make damn sure the airport is secure!?!?"
                                 - Lewis Black, The Daily Show 2002.07.17

Attachment: pgp7ns4Gj1sgd.pgp
Description: PGP signature

Reply via email to