WWW::Modbot::Server - models a server for the modbot
Version 0.01
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.
WWW::Modbot::Server
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.
$bot-
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 does nothing in this parent class, but it's used in the specific types to carry out the actual connection.
connect
get_config gets the proper configuration value for the server in question.
get_config
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.
scan_pending
get retrieves a single post from a server given the post's unique ID. It returns a hash reference.
get
get_post does the same, but returns a WWW::Modbot::Post object containing that hash reference.
get_post
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.
can
server_can
judge
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.
scan
This is the workhorse function of the entire module, of course.
Michael Roberts, <michael at despammed.com>
<michael at despammed.com>
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.
bug-www-modbot at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Modbot
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Modbot
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Modbot
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Modbot
Search CPAN
http://search.cpan.org/dist/WWW-Modbot/
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.
To install WWW::Modbot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Modbot
CPAN shell
perl -MCPAN -e shell install WWW::Modbot
For more information on module installation, please visit the detailed CPAN module installation guide.