|
NAMEClamd - Connect to a local clamd service and send commandsSYNOPSISmy $clamd = Clamd->new(); if ($clamd->ping) { my %found = $clamd->scan('/tmp'); foreach my $file (keys %found) { print "Found virus: $found{$file} in $file\n"; } } DESCRIPTIONThis module provides a simplified perl interface onto a local clamd scanner, allowing you to do fast virus scans on files on your local hard drive. It also simplifies and unifies the clamd interface.APInew()Create a new Clamd object. By default tries to connect to a local unix domain socket at /tmp/clamd. Options are passed in as key/value pairs.Available Options:
ping()Pings the clamd to check it is alive. Returns true if it is alive, false if it is dead. Note that it is still possible for a race condition to occur between your test for ping() and any call to scan(). See below for more details.scan($dir_or_file)Scan a directory or a file. Note that the resource must be readable by the user clamd is running as.Returns a hash of "filename => virusname" mappings. If we cannot connect to the clamd backend for any reason, an exception will be thrown. If clamd encounters an error (for example it cannot read a file) then it will throw an exception. If you wish to continue in the presence of errors, you will need to pass an option to scan() as follows: $clamd->scan($dir, { RaiseError => 0 }); rawscan($dir_or_file)Same as scan(), but does not scan inside of archives.quit()Sends the QUIT message to clamd, causing it to cleanly exit.This may or may not work, I think due to bugs in clamd's C code (it does not waitpid after a child exit, so you get zombies). However it seems to be fine on BSD derived operating systems (i.e. it's just broken under Linux). The test file t/03quit.t will currently wait 5 seconds before trying a kill -9 to get rid of the process. You may have to do something similar on Linux, or just don't use this method to kill Clamd - use "kill `cat /path/to/clamd.pid`" instead which seems to work fine. reload()Cause clamd to reload its virus database.AUTHORMatt Sergeant, All Rights Reserved.LICENSEThis is free software. You may use and distribute it under the same terms as perl itself.POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |