NAME

Antispam::Toolkit::Role::ContentChecker - A role for classes which check whether a piece of content is spam

VERSION

version 0.08

SYNOPSIS

  package MyContentChecker;

  use Moose;

  with 'Antispam::Toolkit::Role::ContentChecker';

  sub check_content { ... }

DESCRIPTION

This role specifies an interface for classes which check whether a piece of content is spam.

ATTRIBUTES

This role provides one attribute:

$checker->_accepted_content_types()

This is an array reference of non-empty strings. Each string should be a MIME type. This attribute cannot be set by the constructor. The class consuming the role must provide a $checker->_build_accepted_content_types() method.

REQUIRED METHODS

Classes which consume this method must provide two methods:

$checker->_build_accepted_content_types()

This method should return an array reference of mime types which the class can check, such as "text/html", "text/plain", etc.

$checker->check_content( ... )

This method implements the actual spam checking for a piece of content. It must accept the following named parameters:

  • content_type

    The MIME type for the piece of content.

  • content

    The content itself. This must be a non-empty string.

METHODS

This role provides an around modifier for the $checker->check_content() method. The modifier does validation on all the parameters, so there's no need to implement this in the class itself.

If the provided content_type is not one of the accepted types, the original method will not be called.

BUGS

See Antispam::Toolkit for bug reporting details.

AUTHOR

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)