1 message in net.sourceforge.lists.courier-users[courier-users] perlfilter question
FromSent OnAttachments
Michael CarmackJun 27, 2004 6:30 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[courier-users] perlfilter questionActions...
From:Michael Carmack (kar@karmak.org)
Date:Jun 27, 2004 6:30:41 am
List:net.sourceforge.lists.courier-users

I'm trying to set up a perlfilter that uses Mail::ClamAV, but I'm having a problem with initializing outside of 'filterdata'. Here's what I'd like to do:

===========================================

use Mail::ClamAV qw/:all/; my $clam = Mail::ClamAV->new(Mail::ClamAV::retdbdir()); $clam->buildtrie; sub filterdata { my $filename=shift; my $status = $clam->scan($filename,CL_MAIL); if ( $status->virus ) { return "500 Virus Detected: $status."; } return ""; }

============================================

Creating the object and calling buildtrie are expensive, so I don't want to run those commands for every message. But the above code generates the following error:

--------------------------------------------

Jun 27 13:22:45 ariel perlfilter: eval error: Can't call method "scan" on an undefined value at (eval 1) line 80, <GEN0> line 1.

---------------------------------------------

Am I going about this wrong?

m.