Brickyard
view release on metacpan or search on metacpan
lib/Brickyard.pm view on Meta::CPAN
which is turned into a custom expansion; see above.
The configuration needs to be a reference to a list of sections as
returned by C<init_from_config()>, for example.
If an object is created that consumes the
L<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;
}
);
=head2 plugins
Read-write accessor for the reference to an array of plugins.
=head2 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.
=head2 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) }
}
=head2 reset_plugins
Clears the array of plugins as well as the cache - see
C<plugins_with()>.
=head2 expand
Holds custom package name expansions; see above.
=head1 INSTALLATION
See perlmodinstall for information and options on installing Perl modules.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at
L<http://rt.cpan.org/Public/Dist/Display.html?Name=Brickyard>.
=head1 AVAILABILITY
The latest version of this module is available from the Comprehensive Perl
Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN
site near you, or see L<http://search.cpan.org/dist/Brickyard/>.
The development version lives at L<http://github.com/hanekomu/Brickyard>
and may be cloned from L<git://github.com/hanekomu/Brickyard.git>.
Instead of sending patches, please fork this project using the standard
git and github infrastructure.
=head1 AUTHOR
Marcel Gruenauer <marcel@cpan.org>
=head1 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 2.658 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )