C:\Perl_PPM\Bread-Board-0.33\blib/lib/Bread/Board/Service/WithDependencies.pm |
add_dependency
get_dependency
has_dependency
has_dependencies
get_all_dependencies
init_params
get
resolve_dependencies
Bread::Board::Service::WithDependencies
version 0.33
This is a sub-role of the Bread::Board::Service manpage, for services with dependencies. It provides the mechanism to recursively resolve dependencies.
dependencies
Hashref, constrained by < Bread::Board::Service::Dependencies
>. Values must be instances of the Bread::Board::Dependency manpage, but can
be coerced from various other types, see the type's docs.
add_dependency
$service->add_dependency(name=>$dep);
Adds a new dependency.
get_dependency
my $dep = $service->get_dependency('name');
Gets a dependency by name.
has_dependency
if ($service->has_dependency('name')) { ... }
Returns true if this service has a dependency with the given name.
has_dependencies
if ($service->has_dependencies) { ... }
Returns true if this service has any dependency.
get_all_dependencies
my %deps = $service->get_all_dependencies;
Returns all the dependencies for this service, as a key-value list.
init_params
Builder for the service parameters, augmented to inject all the
resolved dependencies into the < params
> attribute, so that get
can use them.
get
After the get
method, the < params
> attribute is cleared, to
make sure that dependencies will be resolved again on the next call (of
course, if the service is using a singleton lifecycle, the whole ``getting''
only happens once).
resolve_dependencies
my %name_object_map = $self->resolve_dependencies;
For each element of dependencies, calls its < service
> method to retrieve the
service we're dependent on, then tries to instantiate the value of the
service. This can happen in a few different ways:
get
on it
$service->get(%{$dependency->service_params})
inflate
method, passing it all the needed parameters, to
get the actual instance
Stevan Little <stevan@iinteractive.com>
Please report any bugs or feature requests on the bugtracker website https://github.com/stevan/BreadBoard/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
This software is copyright (c) 2015 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
C:\Perl_PPM\Bread-Board-0.33\blib/lib/Bread/Board/Service/WithDependencies.pm |