| ClamAV::Client(3pm) | User Contributed Perl Documentation | ClamAV::Client(3pm) |
ClamAV::Client - A client class for the ClamAV "clamd" virus scanner daemon
0.11
use ClamAV::Client;
# Try using socket options from clamd.conf, or use default socket:
my $scanner = ClamAV::Client->new();
# Use a local Unix domain socket:
my $scanner = ClamAV::Client->new(
socket_name => '/var/run/clamav/clamd.ctl'
);
# Use a TCP socket:
my $scanner = ClamAV::Client->new(
socket_host => '127.0.0.1',
socket_port => 3310
);
die("ClamAV daemon not alive")
if not defined($scanner) or not $scanner->ping();
my $version = $scanner->version;
# Retrieve the ClamAV version string.
$scanner->reload(); # Reload the malware pattern database.
$scanner->quit(); # Terminates the ClamAV daemon.
$scanner->shutdown(); # Likewise.
# Scan a single file or a whole directory structure,
# and stop at the first infected file:
my ($path, $result) = $scanner->scan_path($path);
my ($path, $result) = $scanner->scan_path(
$path, ClamAV::Client::SCAN_MODE_NORMAL );
my ($path, $result) = $scanner->scan_path(
$path, ClamAV::Client::SCAN_MODE_RAW );
# Scan a single file or a whole directory structure,
# and scan all files without stopping at the first infected one:
my %results = $scanner->scan_path_complete($path);
while (my ($path, $result) = each %results) { ... }
# Scan a stream, i.e. read from an I/O handle:
my $result = $scanner->scan_stream($handle);
# Scan a scalar value:
my $result = $scanner->scan_scalar(\$value);
ClamAV::Client is a class acting as a client for a ClamAV "clamd" virus scanner daemon. The daemon may run locally or on a remote system as ClamAV::Client can use both Unix domain sockets and TCP/IP sockets. The full functionality of the "clamd" client/server protocol is supported.
The following constructor is provided:
%options is a list of key/value pairs representing any of the following options:
The following instance methods are provided:
Daemon maintenance
If an infected file is found, returns a list consisting of the path of the file and the name of the malware signature that matched the file. Otherwise, returns the originally specified path and undef.
Returns a hash with a list of infected files found, with the file paths as the keys and the matched malware signature names as the values.
The clamd and clamav man-pages.
The latest version of ClamAV::Client is available on CPAN and at <http://www.mehnle.net/software/clamav-client>.
Support is usually (but not guaranteed to be) given by the author, Julian Mehnle <julian@mehnle.net>.
ClamAV::Client is Copyright (C) 2004-2005 Julian Mehnle <julian@mehnle.net>.
ClamAV::Client is free software. You may use, modify, and distribute it under the same terms as Perl itself, i.e. under the GNU GPL or the Artistic License.
| 2021-01-03 | perl v5.32.0 |