NAME
Infobot::Base - Useful methods for Infobot modules
SYNOPSIS
package Infobot::YourModule;
use base qw( Infobot::Base );
our @required_modules = qw( Your::Deps::Here );
package main;
die unless Infobot::YourModule->load();
my $object = Infobot::YourModule->new();
DESCRIPTION
This module provides some useful tools that are required by most of the other Infobot components.
METHODS
mk_accessor et al
Inherits from Class::Accessor.
new
This application has been designed with the idea that a new method should be as lightweight as possible, with all initialisation done explicitly with an init() method.
This implementation of new() is about as simple as it gets - will return a hashref blessed in to your class.
load
infobot calls the load() method on all packages it would like to use. This allows a module to check for module dependencies, and anything else it would like. It should return 1 if the plugin can be used, and 0 if not.
The default load module here simply returns the result of an empty call to require_modules (so allows you to set module dependencies in @modules_dependencies.
require_modules
Accepts a list of modules, and attempts to load them using UNIVERSAL::Require. Returns 1 if all load, 0 if any fail. This method will short-circuit on the first error, and will write to the application log multiplexer (priority 2).
If you don't provide a list of modules, the existance of @required_modules is checked for in your package, and used.
require_base
Accepts a single module, and attempts to require it using require_modules). Adds it to the calling package's ISA.
log
Shortcut to Infobot::Stash-new->log()>, the log multiplexer object from Infobot::Log.
set_name
Accepts an object type (such as 'log', 'conduit', or 'query'), and a name, sets $self-{name}> to that name, and sets <$self-{config}>> to <$stash-{config}->{$type}->{$name}->{extras}>>.
stash
Application-wide stash. Accepts either a key (for lookups) or a key + value (for storage).