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.



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to