Jesse Luehrs > Bread-Board-Declare-0.14 > Bread::Board::Declare::Meta::Role::Attribute::Container

Download:
Bread-Board-Declare-0.14.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.14   Source   Latest Release: Bread-Board-Declare-0.16

NAME ^

Bread::Board::Declare::Meta::Role::Attribute::Container - attribute metarole for container attributes in Bread::Board::Declare

VERSION ^

version 0.14

DESCRIPTION ^

This attribute trait indicates that the attribute (in a Bread::Board::Declare class) contains a subcontainer rather than a service. It must be specified explicitly (or else a service that happens to return a container will be created):

  has attr => (
      traits => ['Container'],
      is     => 'ro',
      isa    => 'Bread::Board::Container',
  );

Container attributes (unlike service attributes) can have defaults and builders, allowing you to also define subcontainers inline when desired, as in:

  has attr => (
      traits  => ['Container'],
      is      => 'ro',
      isa     => 'Bread::Board::Container',
      default => sub {
          container Foo => as {
              service Bar => 'BAR';
          };
      }
  );

ATTRIBUTES ^

dependencies

If no default or builder is supplied, the type constraint will be used to create a container instance automatically (using a temporary ConstructorInjection service). This is the dependency specification to use for that temporary service.

AUTHOR ^

Jesse Luehrs <doy at tozt dot net>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Jesse Luehrs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: