Jon Portnoy > Bot-Cobalt > Bot::Cobalt::Core::Role::EasyAccessors

Download:
Bot-Cobalt-0.016002.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.016002   Source  

NAME ^

Bot::Cobalt::Core::Role::EasyAccessors

SYNOPSIS ^

  ## Inside a Bot::Cobalt plugin:
  
  # Current plugin alias:
  my $current_alias = $core->get_plugin_alias($self);

  ## Channels hash for specified context:
  my $chan_cf_hash = $core->get_channels_cfg($context);
  
  ## opts() hash for specified plugin object or alias:
  my $plugin_cf = $core->get_plugin_cfg($self);
  
  ## Core configuration object (Bot::Cobalt::Conf::File::Core):
  my $core_cf = $core->get_core_cfg;

DESCRIPTION ^

Bot::Cobalt core interface role providing simple methods for accessing some of the configuration state tracked by Bot::Cobalt::Core.

get_channels_cfg

Returns the channel configuration hash for the specified context (or an empty hash).

Same as:

  $core->cfg->channels->context($context) || {};

get_core_cfg

Returns the core's Bot::Cobalt::Conf::File::Core object.

Same as:

  $core->cfg->core

get_plugin_alias

Takes an object (or a stringified object, but this happens automatically) and returns the registered alias for the plugin if it is loaded.

get_plugin_cfg

Retrieves the current 'opts()' configuration hash for the specified plugin (or an empty hash).

Takes either a plugin object (as a reference only) or a plugin alias (as a string).

Same as:

  $core->cfg->plugins->plugin(
    $core->get_plugin_alias($self)
  );

AUTHOR ^

Jon Portnoy <avenj@cobaltirc.org>

syntax highlighting: