Bolts
view release on metacpan or search on metacpan
lib/Bolts/Inference/Moose.pm view on Meta::CPAN
my $settings = MyApp::Settings->new;
my $thing = $settings->acquire('thing', {
id => 1,
name => 'something',
}); # works!
=head1 DESCRIPTION
Performs inferrence for L<Moose> object constructor injection on
L<Bolts::Blueprint::Factory>. That is, it is the way in which Bolts will
automatically guess how to build your Moose objects, provided you construct them
with L<Bolts::Blueprint::Factory> (see the L</SYNOPSIS> for an example).
This works by iterating through the attributes on the metaclass for the Moose
object set on the L<Bolts::Blueprint::Factory/class> of the blueprint. If the
attribute has an C<init_arg> set (which all do by default to a name matching the
attribute name), then the dependency will be passed to the constructor as a
parameter. If the C<init_arg> is undefined, but a setter is provided (i.e., you
use C<< isa => 'rw' >> or use C<< writer => 'set_attr' >> or C<< accessor =>
'attr' >> when setting up the attribute), the setter will be used for that
dependency instead. If neither a setter or an C<init_arg> is defined, then the
( run in 4.124 seconds using v1.01-cache-2.11-cpan-748bfb374f4 )