The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MAD::Loader - The MAD module Loader

VERSION

Version 1.0.0

SYNOPSIS

Loads and optionally initializes modules

use MAD::Loader;

my $loader = MAD::Loader->new;
$loader->load(qw{Foo::Bar});

my $foobar = Foo::Bar->new;

METHODS

new

Creates a loader object.

You may provide any optional arguments: inc_dirs, initializer, namespace and options.

See more details about them in documentation of their respective accessors.

load

Takes a list of module names and tries to load all of them in order. If anyone fails to load, an exception is thrown.

inc_dirs

Returns the value of inc_dirs.

The inc_dirs attribute is a list of directories in addition to the ones present in @INC in which the MAD::Loader will search for the modules passed to method load.

The method load will properly localize the array @INC, so the original content is maintained intact when it returns.

initializer

Returns the value of initializer.

The initializer attribute is a string with the name of the method that will be used to initialize the module.

namespace

Returns the namespace where look for modules.

The namespace atribute will be prefixed to the names of the modules before loading them.

options

Returns the value of options.

The options attribute is a list o parameters that will be passed to the initializer method.

on_error

Returns the value of on_error.

The on_error attribute is a coderef executed when a module load fail.

This sub will receive as argumment the exception thrown by require.

Defaults to Carp::croak.

no_import

Returns the value of no_import.

Boolean to indicate whether the import method should be called or not. An additional check is made to ensure that the method exists in the module before executing it.

Deafults to false.

AUTHOR

Blabos de Blebe, <blabos at cpan.org>

BUGS

Please report any bugs or feature requests to bug-mad-loader at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MAD-Loader. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc MAD::Loader

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Blabos de Blebe.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.