NAME
whatbot::Component - Base component for all whatbot modules.
SYNOPSIS
use MooseX::Declare;
use Method::Signatures::Modifiers;
class whatbot::Command extends whatbot::Component {
method foo() {
$self->log->write('I am so awesome.');
}
}
DESCRIPTION
whatbot::Component is the base component for all whatbot modules. This requires a little bit of magic from the caller, as the accessors all need to be filled by whatbot::Controller.
PUBLIC ACCESSORS
- parent
-
The parent component of this module.
- config
-
The whatbot::Config instance.
- ios
-
A HashRef of available whatbot::IO instances.
- log
-
The available whatbot::Log instance, commonly used as $self->log->write('Foo');.
PUBLIC METHODS
- model($model_name)
-
Retrieve the model (or whatbot::Database::Table::*) instance associated with the provided name. For example, to retrieve the active instance of whatbot::Database::Table::Factoid, call $self->model('Factoid'). This will warn and return nothing if the model is not found.
- search_ios($search_string)
-
Retrieve the IO with a partial match to the given string. This is handy for getting the reference to an IO that may have an odd name, like IRC_127.0.0.1.
- dispatch_message( $io_path, $message )
-
Dispatch a whatbot::Message, corresponding to the given IO path, through the command dispatcher.
- dispatch_message( $io_path, $message )
-
Send a whatbot::Message via the given IO name or partial IO name.
LICENSE/COPYRIGHT
Be excellent to each other and party on, dudes.