NAME

Nevermore::Loader - A Universal Class Loader

SYNOPSIS

use Nevermore::Loader;

# Verbose
my @instances = Nevermore::Loader->new
  ->namespace('Some::Namespace')
  ->search
  ->load
  ->base('Some::Module')
  ->instantiate;

# Short
my @instances = Nevermore::Loader->new
  ->modules('Some::Namespace')
  ->instantiate;

# Reload
Nevermore::Loader->reload;

DESCRIPTION

Nevermore::Loader is a universal class loader and plugin framework.

ATTRIBUTES

base

my $base = $loader->base;
$loader  = $loader->base('MyApp::Base');

modules

my @modules = $loader->modules;
$loader     = $loader->modules(qw/MyApp::Foo MyApp::Bar/);

namespace

my $namespace = $loader->namespace;
$loader       = $loader->namespace('MyApp::Namespace');

METHODS

Nevermore::Loader inherits all methods from Nevermore and implements the following new ones.

new

my $loader = Nevermore::Loader->new;
my $loader = Nevermore::Loader->new('MyApp::Namespace');

instantiate

my $first     = $loader->instantiate;
my @instances = $loader->instantiate;
my $first     = $loader->instantiate(qw/foo bar baz/);
my @instances = $loader->instantiate(qw/foo bar baz/);

Note that only the main package will be instantiated, file contents won't be scanned for multiple package declarations.

load

$loader = $loader->load;
$loader = $loader->search;
$loader = $loader->search('MyApp::Namespace');

reload

Nevermore::Loader->reload;