Bot::Cobalt::Core - Bot::Cobalt core and event syndicator
This module is the core of Bot::Cobalt, tying an event syndicator (via POE::Component::Syndicator and Object::Pluggable) into a logger instance, configuration manager, and other useful tools.
Core is a singleton; within a running Cobalt instance, you can always retrieve the Core via the instance method:
require Bot::Cobalt::Core; my $core = Bot::Cobalt::Core->instance;
You can also query to find out if Core has been properly instanced:
if ( Bot::Cobalt::Core->has_instance ) { }
If you 'use Bot::Cobalt;' you can also access the Core singleton instance via the core() exported sugar:
core()
use Bot::Cobalt; core->log->info("I'm here now!")
See Bot::Cobalt::Core::Sugar for details.
Public methods are documented in "Core methods" in Bot::Cobalt::Manual::Plugins and the classes & roles listed below.
See also:
Bot::Cobalt::Manual::Plugins - Cobalt plugin authoring manual
Bot::Cobalt::IRC - IRC bridge / events
Bot::Cobalt::Core::Role::EasyAccessors
Bot::Cobalt::Core::Role::IRC
Bot::Cobalt::Core::Role::Timers
It's trivially possible to write custom frontends to spawn a Cobalt instance; Bot::Cobalt::Core just needs to be initialized with a valid configuration object and spawned via POE::Kernel's run() method.
A configuration object is an instanced Bot::Cobalt::Conf:
my $conf_obj = Bot::Cobalt::Conf->new( etc => $path_to_etc_dir, );
. . . then passed to Bot::Cobalt::Core before the POE kernel is started:
## Instance a Bot::Cobalt::Core singleton ## Further instance() calls will return the singleton Bot::Cobalt::Core->instance( cfg => $conf_obj, var => $path_to_var_dir, ## See perldoc Bot::Cobalt::Logger regarding log levels: loglevel => $loglevel, ## Debug levels: debug => $debug, ## Indicate whether or not we're a daemon ## (Changes behavior of logging and signals) detached => $detached, )->init;
Frontends have to worry about daemonization on their own.
Jon Portnoy <avenj@cobaltirc.org>
To install Bot::Cobalt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Cobalt
CPAN shell
perl -MCPAN -e shell install Bot::Cobalt
For more information on module installation, please visit the detailed CPAN module installation guide.