Jon Portnoy > Bot-Cobalt-0.016000 > Bot::Cobalt::Core::ContextMeta

Download:
Bot-Cobalt-0.016000.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.016000   Source   Latest Release: Bot-Cobalt-0.016002

NAME ^

Bot::Cobalt::Core::ContextMeta - Base class for context-related metadata

SYNOPSIS ^

  $cmeta->add($context, $key, $ref);
  
  $cmeta->del($context, $key);
  
  $cmeta->clear($context);
  
  $cmeta->list($context);

DESCRIPTION ^

This is the ContextMeta base class, providing some easy per-context hash management methods to subclasses such as Bot::Cobalt::Core::ContextMeta::Auth and Bot::Cobalt::Core::ContextMeta::Ignore.

Bot::Cobalt::Core uses ContextMeta subclasses to provide auth and ignore attributes.

add

  ->add($context, $key, $meta_ref)

Add a new item; subclasses will usually use a custom constructor to provide a custom metadata hashref as the third argument.

del

  ->del($context, $key)

Delete a specific item.

clear

  ->clear()
  
  ->clear($context)

Clear a specified context entirely.

With no arguments, clear everything we know about every context.

fetch

  ->fetch($context, $key)

Retrieve the 'meta' hash reference for a specified key.

list

In list context, returns the list of keys:

  my @contexts = $cmeta->list;
  my @ckeys    = $cmeta->list($context);

In scalar context, returns the actual hash reference (if it exists).

list_as_ref

Less-ambiguous alternative to "list" -- always get a hash reference.

list_as_array

Less-ambiguous alternative to "list" -- always get a list of keys.

AUTHOR ^

Jon Portnoy <avenj@cobaltirc.org>

http://www.cobaltirc.org

syntax highlighting: