SpamAssassin Install Prefix

Mariano Absatz mailscanner at LISTS.COM.AR
Wed Apr 30 17:52:15 IST 2003


Following your suggestion, this patch is much simpler, then... anyway, if 
SpamAssassin is _not_ there, the "eval" will catch it and die gracefully.

I used $^V (equivalent to $PERL_VERSION) in order to not have to "use 
English;" (or is it used somewhere and I didn't see it?).

El 30 Apr 2003 a las 16:24, Tony Finch escribió:

> Mariano Absatz <mailscanner at LISTS.COM.AR> wrote:
> >
> >the patch below is a little more general... it can only get confused if
> >there's more than one SpamAssassin with the same "SpamAssassin Install
> >Prefix" for different Perl installations... a relativeley unlikely event
> >that will probably have other side effects besides this one...
> 
> I suggested to Julian that he use $PERL_VERSION in the path added to
> @INC which should do the right thing. (This is the "English" version of
> the variable name which is compatible with perl <= 5.005 and >= 5.6.)
> 
*** SA.pm.old   Tue Apr 29 17:33:11 2003
--- SA.pm       Wed Apr 30 13:47:38 2003
***************
*** 72,77 ****
--- 72,87 ----
  
    unless (MailScanner::Config::IsSimpleValue('usespamassassin') &&
            !MailScanner::Config::Value('usespamassassin')) {
+     # BBY 2003-04-30: this is necessary for the "require Mail::SpamAssassin" 
+     # to work if spamassassininstallprefix is not in the standard @INC or
+     # is not the in the same place as MailScanner (that was pushed onto @INC
+     # earlier)
+     $val = MailScanner::Config::Value('spamassassininstallprefix');
+     if ($val ne "") {
+       $settings{PREFIX} = $val;
+       $val .= "/lib/perl5/site_perl/" . $^V ;
+       unshift @INC, $val;
+     }
      MailScanner::Log::DieLog("SpamAssassin installation could not be found")
        unless eval "require Mail::SpamAssassin";
      $settings{dont_copy_prefs} = 1; # Removes need for home directory
***************
*** 79,94 ****
      $settings{userprefs_filename} = $prefs if defined $prefs;
      $val = MailScanner::Config::Value('debugspamassassin');
      $settings{debug} = $val;
-     # Bunch of extra settings only used by Tony Finch, so not mentioned
-     # in supplied MailScanner.conf file.
      $val = MailScanner::Config::Value('spamassassinuserstatedir');
      $settings{userstate_dir} = $val if $val ne "";
      $val = MailScanner::Config::Value('spamassassinlocalrulesdir');
      $settings{LOCAL_RULES_DIR} = $val if $val ne "";
      $val = MailScanner::Config::Value('spamassassindefaultrulesdir');
      $settings{DEF_RULES_DIR} = $val if $val ne "";
-     $val = MailScanner::Config::Value('spamassassininstallprefix');
-     $settings{PREFIX} = $val if $val ne "";
      $MailScanner::SA::SAspamtest = new Mail::SpamAssassin(\%settings);
  
      #if ($prefs ne "") {
--- 89,100 ----


--
Mariano Absatz
El Baby
----------------------------------------------------------
If at first you don't succeed, call it version 1.0




More information about the MailScanner mailing list