NAME
Mojo::Loader - Loader
SYNOPSIS
use Mojo::Loader;
my $loader = Mojo::Loader->new;
my $modules = $loader->search('Some::Namespace');
$loader->load($modules->[0]);
DESCRIPTION
Mojo::Loader is a class loader and plugin framework.
METHODS
Mojo::Loader inherits all methods from Mojo::Base and implements the following new ones.
load
my $e = $loader->load('Foo::Bar');
Load a class and catch exceptions. Note that classes are checked for a new
method to see if they are already loaded.
if (my $e = $loader->load('Foo::Bar')) {
die "Exception: $e" if ref $e;
}
search
my $modules = $loader->search('MyApp::Namespace');
Search for modules in a namespace non-recursively.
$loader->load($_) for @{$loader->search('MyApp::Namespace')};