NAME

Catalyst::Plugin::ClamAV - ClamAV scanning Plugin for Catalyst

SYNOPSIS

use Catalyst;
MyApp->setup( qw/ ClamAV / );

# configuration for using unix domain socket
MyApp->config->{clamav} = {
    socket_name => '/var/sock/clam',
};

# configuration for using TCP/IP socket
MyApp->config->{clamav} = {
    socket_host => '127.0.0.1',
    socket_port => '3310',
};

# Virus scan upload files.
my $found = $c->clamscan('field1', 'field2');

my @found_virus = $c->clamscan('field1', 'field2');
# e.g. @found_virus == ( { name => 'field1', signature => 'VIRUSNAME' } );

DESCRIPTION

This plugin add virus scan method (using ClamAV) for Catalyst.

Using ClamAV::Client module.

CONFIGURATION

MyApp->config->{clamav}->{socket_name};    # UNIX domain socket
MyApp->config->{clamav}->{socket_host};    # TCP/IP host
MyApp->config->{clamav}->{socket_port};    # TCP/IP port

See ClamAV::Client POD.

METHODS

clamscan

Scan uploaded file handles, using ClamAV::Client->scan_stream(). Takes file upload field names as arguments.

HTML:

<form action="/upload" method="post" enctype="multipart/form-data">
  <input type="file" name="field1">
  <input type="file" name="field2">
</form>

Controller:

$found = $c->clamscan('field1', 'field2');

The number of found viruses is returned. If clamd is stopping ( $scanner->ping failed ), -1 returned.

To get found virus detail,

@found_virus = $c->clamscan('field1', 'field2');

@found_virus is list of hash ref ( e.g. { name => 'fieldname', signature => 'virusname' } ).

SEE ALSO

Catalyst ClamAV::Client

AUTHOR

FUJIWARA Shunichiro, <fujiwara@topicmaker.com>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by FUJIWARA Shunichiro.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.