GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Bread::Board::Service::WithDependencies(3) User Contributed Perl Documentation Bread::Board::Service::WithDependencies(3)
 

Bread::Board::Service::WithDependencies - Services with dependencies

version 0.36

This is a sub-role of Bread::Board::Service, for services with dependencies. It provides the mechanism to recursively resolve dependencies.

Hashref, constrained by "Bread::Board::Service::Dependencies". Values must be instances of Bread::Board::Dependency, but can be coerced from various other types, see the type's docs.

  $service->add_dependency(name=>$dep);
Adds a new dependency.

  my $dep = $service->get_dependency('name');
Gets a dependency by name.

  if ($service->has_dependency('name')) { ... }
Returns true if this service has a dependency with the given name.

  if ($service->has_dependencies) { ... }
Returns true if this service has any dependency.

  my %deps = $service->get_all_dependencies;
Returns all the dependencies for this service, as a key-value list.

Builder for the service parameters, augmented to inject all the resolved dependencies into the "params" attribute, so that "get" can use them.

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).

  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:
the service is not locked, and does not require any parameter
just call "get" on it
the service is not locked, requires parameters, but the dependency has values for them
call "$service->get(%{$dependency->service_params})"
the service is not locked, requires parameters, and we don't have values for them
we can't instantiate anything at this point, so we use a Bread::Board::Service::Deferred::Thunk instance, on which you can call the "inflate" method, passing it all the needed parameters, to get the actual instance
the service is locked
we return a Bread::Board::Service::Deferred that will proxy to the instance that the service will eventually return; yes, this means that in many cases circular dependencies can be resolved, at the cost of a proxy object

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) 2017, 2016, 2015, 2014, 2013, 2011, 2009 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.
2017-09-25 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.