Brickyard
view release on metacpan or search on metacpan
initializes it with the plugin configuration hash and adds it to the
brickyard's array of plugins.
Any configuration keys that appear in the configuration's root section
are set on the root object. So the root object can be anything that has
set-accessors for all the configuration keys that can appear in the
configuration's root section. One exception is the "expand" key, which
is turned into a custom expansion; see above.
The configuration needs to be a reference to a list of sections as
returned by "init_from_config()", for example.
If an object is created that consumes the Brickyard::Role::PluginBundle
role, the bundle is processed recursively.
If the callback is given, each value from a key-value pair is filtered
through that callback. For example, you might want to support
environment variable expansion like this:
$brickyard->init_from_config(
'myapp.ini',
$root_config,
sub {
my $value = shift;
$value =~ s/\$(\w+)/$ENV{$1} || "\$$1"/ge;
$value;
}
);
plugins
Read-write accessor for the reference to an array of plugins.
plugins_with
Takes a role name and returns a list of all the plugins that consume
this role. The result is cached, keyed by the role name.
plugins_agree
Takes a role name and a code reference and calls the code reference once
for each plugin that consumes the role. It returns 1 if the code returns
a true value for all plugins, 0 otherwise.
An example will make this clearer:
# Let the plugins decide
sub value_is_valid {
my ($self, $value) = @_;
$self->brickyard->plugins_agree(-ValueChecker =>
sub { $_->value_is_valid($value) }
}
reset_plugins
Clears the array of plugins as well as the cache - see "plugins_with()".
expand
Holds custom package name expansions; see above.
INSTALLATION
See perlmodinstall for information and options on installing Perl
modules.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at
<http://rt.cpan.org/Public/Dist/Display.html?Name=Brickyard>.
AVAILABILITY
The latest version of this module is available from the Comprehensive
Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a
CPAN site near you, or see <http://search.cpan.org/dist/Brickyard/>.
The development version lives at <http://github.com/hanekomu/Brickyard>
and may be cloned from <git://github.com/hanekomu/Brickyard.git>.
Instead of sending patches, please fork this project using the standard
git and github infrastructure.
AUTHOR
Marcel Gruenauer <marcel@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
( run in 1.790 second using v1.01-cache-2.11-cpan-39bf76dae61 )