---
name: "Bread::Board::Container::Parameterized"
section: "3pm"
platform: "linux"
package: "libbread-board-perl"
version: "0.37-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Bread::Board::Container::Parameterized"
---

# Bread::Board::Container::Parameterized(3pm)

A parameterized container

## NAME

Bread::Board::Container::Parameterized - A parameterized container

## VERSION

version 0.37

## DESCRIPTION

This class implements a sort of container factory for Bread::Board: a parameterized container is a, in practice, a function from a set of parameters (which must be containers) to an actual container. See Bread::Board::Manual::Example::FormSensible for an example.

## ATTRIBUTES

### "name"

Read/write string, required. Every container needs a name, by which it can be referenced when fetching it.

### "allowed\_parameter\_names"

Read-only arrayref of strings, required. These are the names of the containers that must be passed to `"create"` to get an actual container out of this parameterized object.

### "container"

This attribute holds the "prototype" container. Services inside it can depend on service paths that include the container names given in "allowed\_parameter\_names".

## METHODS

### "add\_service"

### "get\_service"

### "has\_service"

### "get\_service\_list"

### "has\_services"

### "add\_sub\_container"

### "get\_sub\_container"

### "has\_sub\_container"

### "get\_sub\_container\_list"

### "has\_sub\_containers"

All these methods are delegated to the "prototype" "container", so that this object can be defined as if it were a normal container.

### "create"

```
  my $container = $parameterized_container->create(%params);
```

After checking that the keys of `%params` are exactly the same strings that are present in "allowed\_parameter\_names", this method clones the prototype "container", adds the `%params` to the clone as sub-containers, and returns the clone.

If this was not a top-level container, the parent is also cloned, and the container clone is added to the parent clone.

Please note that the container returned by this method does *not* have the same name as the parameterized container, and that calling this method with different parameter values will return different containers, but all with the same name. It's probably a bad idea to instantiate a non-top-level parameterized container more than once.

### "fetch"

### "resolve"

These two methods die, since services in a parameterized container won't usually resolve, and attempting to do so is almost always a mistake.

## AUTHOR

Stevan Little \<stevan@iinteractive.com\>

## BUGS

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.

## COPYRIGHT AND LICENSE

This software is copyright (c) 2019, 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.
