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::Types(3) User Contributed Perl Documentation Bread::Board::Types(3)

Bread::Board::Types - types and coercions for Bread::Board

version 0.37

This package defines types and coercions for Bread::Board.

A hashref mapping strings to instances of Bread::Board::Container or Bread::Board::Container::Parameterized.

Can be coerced from an arrayref of containers: the keys will be the containers' names.

A hashref mapping strings to instances of Bread::Board::Service.

Can be coerced from an arrayref of services: the keys will be the services' names.

Hashref mapping strings to instances of Bread::Board::Dependency.

The values of the hashref can be coerced in several different ways:

a string
will be interpreted as the "service_path"
a hashref with a single key
the key will be interpreted as a "service_path", and the value as a hashref for "service_params"
an arrayref
each element will be interpreted as a dependency (possibly through all the coercions listed here); see below for an example
a service object
will be interpreted as a dependency on that service
a dependency object
will be taken as-is

Instead of a hashref of any of the above things, you can use an arrayref: it will be coerced to hashref, using the (coerced) dependencies' names as keys.

Examples

   service foo => (
     class => 'Foo',
     dependencies => {
       { bar => { attribute => 12 } },
     },
   );

The service "foo" depends on the parameterized service "bar", and "bar" will be instantiated passing the hashref "{ attribute => 12 }" to its "get" method.

   service foo => (
     class => 'Foo',
     dependencies => {
       things => [ 'bar', 'baz' ],
     },
   );

The service "foo" depends on the services "bar" and "baz", and when instantiating "foo", its constructor will receive something like "things => [ $instance_of_bar, $instance_of_baz ]".

   service foo => (
     class => 'Foo',
     dependencies => {
       things => [
         { bar => { attribute => 12 } },
         { bar => { attribute => 27 } },
       ],
     },
   );

You can mix&match the coercions! This "foo" will get two different instances of "bar" in its "things" attribute, each "bar" instantiated with a different value.

Hashref mapping strings to MooseX::Params::Validate specifications.

Can be coerced from an arrayref of strings:

  [qw(a b c)]

becomes:

  {
    a => { optional => 0 },
    b => { optional => 0 },
    c => { optional => 0 },
  }

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

2019-06-28 perl v5.32.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.