Author image Michael Roberts
and 1 contributors

NAME

WWW::Modbot::Server - models a server for the modbot

VERSION

Version 0.01

SYNOPSIS

The WWW::Modbot::Server object is largely a parent class for the specific server types. It provides an API the modbot uses when talking to a server. Note that a physical server may very well have more than one "spam server" if there are multiple tables containing spam-like substances. For instance, the Scoop community server's primary spam source is comments, but story submissions can also be spam, and there are even spam-like story tags. So a Scoop server is modeled as three separate modbot servers, sharing a single underlying database connection.

FUNCTIONS

new

Connects to a configured server. Yes, this means that only configured servers can be connected to. However, nobody says you have to get your configuration from the modbot.conf file; you simply have to make sure that the $bot-{config}> hash has the server defined and any variables defined that the server's specific type will need to establish the connection.

This looks for an implementation module in the local 'lib' directory first (under 'lib/Server') and, failing that, tries the module's own list. This lets you implement test environments and move server interface modules into production at will. The local library overrides the system definition for this very reason.

connect

connect does nothing in this parent class, but it's used in the specific types to carry out the actual connection.

get_config

get_config gets the proper configuration value for the server in question.

scan_pending

scan_pending scans the server for pending messages (whether spam or not). It returns a hash reference, the keys of which are the unique post IDs and the values of which are a descriptive string arbitrarily assigned by the server module.

get and get_post

get retrieves a single post from a server given the post's unique ID. It returns a hash reference.

get_post does the same, but returns a WWW::Modbot::Post object containing that hash reference.

can

can is implemented in a normal server as server_can, leaving can defined here at the class level to ensure that the semantics of canning spam include sending it to the archive configured for the bot. Before archival, a post is retrieved and judge is called to calculate a score.

scan

scan is another helpful shell around specific server functionality. It scans the pending posts on the server, asks the bot to judge each one, and cans the spam above the configured threshold and approves it below the configured approval threshold. Anything left is left on the queue.

This is the workhorse function of the entire module, of course.

AUTHOR

Michael Roberts, <michael at despammed.com>

BUGS

Please report any bugs or feature requests to bug-www-modbot at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Modbot. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::Modbot

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2008 Vivtek, all rights reserved.

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