Bread::Board::LazyLoader::Site - loads tree of IOC files alongside pm file
version 0.11
In module dir we have files, each one containing the definition of one Bread::Board::Container
lib/My/Site/Supp/Database.ioc lib/My/Site/Root.ioc lib/My/Site/Config.ioc lib/My/Site/Database.ioc lib/My/Site/Planner.ioc lib/My/Site/AQ.ioc
the "site" module lib/My/Site.pm is defined like
lib/My/Site.pm
package My::Site; use strict; use warnings; use Bread::Board::LazyLoader::Site; 1;
in the script
use My::Site; my $root = My::Site->root; my $db_container = $root->fetch('Database'); my $dbh = $root->resolve(service => 'Database/dbh');
Site module is a module with a class method root returning an instance of Bread::Board::Container.
root
Bread::Board::Container
Bread::Board::LazyLoader::Site just imports such root method.
Bread::Board::LazyLoader::Site
use Bread::Board::LazyLoader::Site %params;
Directory searched for container files. By default it is the directory with the same name as module file without suffix.
Suffix of container files. By default ioc.
ioc
Another site module. All container files are loaded on top of the base file containers.
Roman Daniel <roman@daniel.cz>
This software is copyright (c) 2016 by Roman Daniel.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Bread::Board::LazyLoader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bread::Board::LazyLoader
CPAN shell
perl -MCPAN -e shell install Bread::Board::LazyLoader
For more information on module installation, please visit the detailed CPAN module installation guide.