NAME
CHI::Config::DriverPool - A Collection of Driver definitions
VERSION
version 0.001000
SYNOPSIS
use CHI::Config::DriverPool;
my $dp = CHI::Config::DriverPool->new();
$dp->add_driver(
name => ... # See CHI::Config::Driver for arguments
);
$dp->get_driver($name); # Fetches a CHI::Config::Driver instance
$dp->get_cache($name); # Shorthand for $dp->get_driver($name)->get_cache
DESCRIPTION
This container serves to aggregate configuration of all driver configurations across multiple files.
It is assumed that the consumer is traversing a tree of configurations of some kind in order of "most relevant" to "least relevant", for example, "most relevant" would be the files in ./
, second-most relevant would be ~/
somewhere, somewhere later is /etc/
and least relevant is any defaults provided by the program itself.
As such, the first definition seen of any given name is considered "the one" to be used and subsequent ones are ignored.
METHODS
add_driver
Create and inject a unique driver configuration in the dictionary.
First come first served.
$pool->add_driver( %config );
Arguments for %config
are the same as for CHI::Config::Driver->new()
.
get_driver
Fetch a named driver configuration from the dictionary.
$pool->get_driver( $name );
This will return a CHI::Config::Driver
instance, or croak
if one does not exist.
get_cache
Fetch and a named CHI
cache object by requesting one from the named CHI::Config::Driver
object.
ENVIRONMENT
CHI_CONFIG_DEBUG
Enables reporting where driver definitions are being shadowed.
This will show shadowing everywhere there is user defined configuration in addition to a default, so is potentially more noisy than intended, but it is hopefully useful in diagnosing misplaced identifiers.
AUTHOR
Kent Fredric <kentnl@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.