*SOLVED*

Well, I go in and add a couple lines of code to get it to work.  Really
strange.  I first re-installed both razor packages (using PREFIX=$HOME),
which always installs my libraries into $home/lib.  I then added the
following two lines of code to my Razor2.pm file (around line 66):

  # figure out if razor is even available or not ...
  $self->{razor2_available} = 0;
  if ($mailsaobject->{local_tests_only}) {
    dbg("razor2: local tests only, skipping Razor");
  }
  else {
    use lib "/home/skipmorrow/lib/perl/5.8.8"; #added line here
    push @INC, "/home/skipmorrow/lib/perl/5.8.8"; #added line here
    if (eval { require Razor2::Client::Agent; }) {
      $self->{razor2_available} = 1;
      dbg("razor2: razor2 is available, version " .
$Razor2::Client::Version::VERSION . "\n");
    }

It's working great for me now.  Thanks to everyone who tried helping over
email :)

Skip


MrGibbage wrote:
> 
> I have been trying to install Razor2 for two days now.  I am on a
> Dreamhost VPS, but I don't have root access, so my perl modules go in
> ~/share/perl.  I have that in my PERL5LIB environment variable.  And yet,
> when I receive an email, I get the following types of messages in my logs:
> [20377] dbg: config: read file
> /home/skipmorrow/share/spamassassin/25_razor2.cf
> [20377] dbg: plugin: loading Mail::SpamAssassin::Plugin::Razor2 from @INC
> [20377] dbg: razor2: razor2 is not available
> 
> I have found that if I move/remove the Razor2.pm from my Plugins
> directory, I don't get any new error messages in my log, because Razor2 is
> also installed on the machine in /usr/share/perl5/Mail/SpamAssassin/Plugin
> 
> But I did find that if I deleted a pluin from my installation that was not
> pre-installed in the /usr, that I get a nice warning message here:
> [2874] warn: plugin: failed to parse plugin (from @INC): Can't locate
> Mail/SpamAssassin/Plugin/URICountry.pm in @INC (@INC contains: lib
> /home/skipmorrow/share/perl/5.8.8 /etc/perl /usr/local/lib/perl/5.8.8
> /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5
> /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at (eval
> 80) line 1.
> 
> Ah ha, so my perl environment looks like that when procmail is running. 
> It looks to me that if I have any perl modules that I want procmail/SA to
> recognize that aren't pre-installed, then I need to put them in
> /home/skipmorrow/share/perl/5.8.8.  Keep that in mind...
> 
> Looking at the source code for Razor2.pm, I see the line that generates
> the "razor2 is not available" error message.
> if (eval { require Razor2::Client::Agent; }) {
>       $self->{razor2_available} = 1;
>       dbg("razor2: razor2 is available, version " .
> $Razor2::Client::Version::VERSION . "\n");
>     }
>     else {
>       dbg("razor2: razor2 is not available... looking for
> Razor2::Client::Agent");
>     }
>  
> I made a small change to the text that is output when
> Razor2::Client::Agent is not found, and indeed, the new error message
> appears.  So, now we know that Razor2 is looking for
> Razor2::Client::Agent.  And it has to be in
> /home/skipmorrow/share/perl/5.8.8 in order for SA to find it.  And that's
> where mine is:
> skipmor...@ps11651:~$ pwd
> /home/skipmorrow
> skipmor...@ps11651:~$ ls share/perl/5.8.8/
> .  ..  Bundle  CPANPLUS.pm  IP  Mail  Razor2  spamassassin-run.pod
> skipmor...@ps11651:~$ ls share/perl/5.8.8/Razor2/
> .  ..  Client  Engine  Errorhandler.pm  Logger.pm  Preproc  Signature 
> String.pm  Syslog.pm
> skipmor...@ps11651:~$ ls share/perl/5.8.8/Razor2/Client/
> .  ..  Agent.pm  Config.pm  Core.pm  Engine.pm  Version.pm
> 
> Thanks to the great tips I received in the other thread I posted about the
> different environments between when logged in as a shell user, and when
> procmail is running, I added a few commands to my .procmailrc to get the
> userid and environment settings
> (http://www.nabble.com/OT--Linux-environment-tt24427323.html):
> 
> User:
> uid=15203(skipmorrow) gid=588771(pg2222652) groups=588771(pg2222652)
> 
> Environment:
> LINEBUF=2048
> LOGNAME=skipmorrow
> HOME=/home/skipmorrow
> ORGMAIL=/var/mail/skipmorrow
> PROCMAIL_VERSION=3.22
> SENDMAILFLAGS=-oi
> SHELLFLAGS=-c
> MSGPREFIX=msg.
> LOCKEXT=.lock
> SHELLMETAS=&|<>~;?*[
> HOST=ps11651
> PATH=/home/skipmorrow/bin:/usr/local/bin:/usr/bin:/bin
> DEFAULT=/home/skipmorrow/Maildir/
> MAILDIR=/home/skipmorrow/Maildir
> PMDIR=/home/skipmorrow/Procmail
> LOGFILE=/home/skipmorrow/Procmail/log
> SHELL=/bin/sh
> SENDMAIL=/usr/sbin/sendmail
> FORMAIL=/usr/bin/formail
> 
> I can run the razor-* scripts in home/skipmorrow/bin, so I know it *will*
> work, but I just can't get it to work when SA/Procmail is running it.
> 
> skipmor...@ps11651:~$ ./bin/razor-check -d email_saves/msg.ulg0E >
> email.debug
> 
> And I see nothing remarkable in the email.debug (the mail I piped in is
> found to be known spam)
> <snip>
> Jul 11 11:19:46.978415 check[10659]: [ 3] mail 1 is known spam.
> Jul 11 11:19:46.978454 check[10659]: [ 5] disconnecting from server
> c301.cloudmark.com
> Jul 11 11:19:46.978523 check[10659]: [ 4] c301.cloudmark.com << 5
> Jul 11 11:19:46.978549 check[10659]: [ 6] a=q
> Jul 11 11:19:46.978641 check[10659]: [ 8] razor-check finished
> successfully.
> 
> So, Razor experts, please, what else can I do to get this running?  I must
> be close.  
> 

-- 
View this message in context: 
http://www.nabble.com/Razor2-just-won%27t-work...-sigh-tp24442758p24448107.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.

Reply via email to