This example was inspired by a discussion I had with Jay Shirley. He wanted to know an easy way to have a dynamic list of output types for his Log::Dispatch object.

Often with Bread::Board you will be wiring up components that are of a fixed type and set, but this is not always the case. It is in these cases when you can simply use the Bread::Board objects themselves to fetch your dependencies.

The value passed into the block of a BlockInjection service is the service itself. Calling the parent method on that service will give you the container that service is in. From there you can introspect the other containers and services any which way you want to.

This example can be made even more dynamic if you build the 'Logging' component as a parameterized container whose parameter is the 'Ouputs' container. Here is what that would look like.

This example illustrates how when a parameterized container is instantiated, the parameters become sub-containers of the resulting container. This makes it just as easy to fetch the 'Outputs' container and use it inside the 'Logger' service.