The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bot::Cobalt::Core::Loader - Object loader/unloader

SYNOPSIS

  use Try::Tiny;
  require Bot::Cobalt::Core::Loader;

  ## Attempt to import a module:
  my $plugin_obj = try {
    Bot::Cobalt::Core::Loader->load($module_name, @args)
  } catch {
    # . . . load failed, maybe die with an error . . .
  };

  ## Check reloadable status of a plugin object:
  if ( Bot::Cobalt::Core::Loader->is_reloadable($plugin_obj) ) {
   . . .
  }

  ## Clean up a module after dropping a plugin object:
  Bot::Cobalt::Core::Loader->unload($module_name);

DESCRIPTION

A small load/unload class for managing Bot::Cobalt plugins.

load

Given a module name in the form of 'My::Module', tries to load and instantiate the specified module view new().

Optional arguments can be specified to be passed to new():

  $obj = Bot::Cobalt::Core::Loader->load($module_name, @args)

Throws an exception on error.

unload

Given a module name in the form of 'My::Module', tries to delete the module from %INC and clear relevant symbol table entries.

Always returns boolean true.

is_reloadable

Given a blessed object, checks to see if the plugin declares itself as NON_RELOADABLE. Returns boolean true if the object appears to be declared reloadable.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>