The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

File::VirusScan::Engine - Engine class for File::VirusScan backends

SYNOPSIS

    use File::VirusScan::Engine;
    @ISA = qw( File::VirusScan::Engine );

DESCRIPTION

File::VirusScan::Engine provides a base class and utility methods for implementing File::VirusScan support for various virus scanners.

Backend engine classes are named with the format:

File::VirusScan::Engine::(Daemon | Command)::Vendor::Product

where Daemon or Command specifies whether or not this speaks directly to a daemon, or invokes a commandline interface, and Vendor and Product are the names of the product as of the writing of these modules.

Note that

  • Some backends use their own commandline tool to speak to a scanning daemon. These are implemented under Command, not Daemon, as we need to invoke an external binary and parse commandline output to interpret the results.

  • Vendor and product names may change more frequently than the interfaces to those products. The names used here are correct as of the writing of this package.

INSTANCE METHODS

scan ( $path )

Generic scan() method. Takes a pathname to scan. Returns a File::VirusScan::Result object which can be queried for status.

Generally, this will be implemented by the subclass.

UTILITY METHODS FOR SUBCLASSES

list_files ( $path )

Returns a list of all files below $path, recursing into directories.

Some scanners can only scan individual files, rather than understanding directories themselves. This gives us a lightweight way to find all files for scanning.

Will die with "Could not open directory $path: $!" if directory cannot be opened.

_run_commandline_scanner ( $command, $match )

Runs the command given by $command. Returns the exit status of that command, and a string containing any lines of output that match the regular expression $match.

DEPENDENCIES

IO::Dir, IO::File

AUTHOR

Dave O'Neill (dmo@roaringpenguin.com)

LICENCE AND COPYRIGHT

Copyright (c) 2007 Roaring Penguin Software, Inc.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.