Bread:...::Types(3pm)

πŸ“¦
version 0.37 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– Bread::Board::Types β€” the vibe check ✨

okay so bestie, you found the manual page for Bread::Board::Types, which lives in the Bread:...::Types(3pm) corner of the User Contributed Perl Documentation universe. it's giving types and coercions for Bread::Board energy, and honestly? it ate. let's get into it 🫢


🌸 NAME 🌸

Bread::Board::Types β€” types and coercions for Bread::Board. that's the whole name, no notes πŸ’…


✨ VERSION ✨

version 0.37 β€” yes queen, that's the one πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this package defines types and coercions for Bread::Board. that's it. that's the description. short and iconic, periodt πŸ’–


πŸŽ€ TYPES πŸŽ€

🌈 "Bread::Board::Container::SubContainerList"

a hashref mapping strings to instances of Bread::Board::Container or Bread::Board::Container::Parameterized. like a lil directory of containers, no cap.

can be coerced from an arrayref of containers β€” and the keys will be the containers' names. slay ✨

πŸ’œ "Bread::Board::Container::ServiceList"

a hashref mapping strings to instances of Bread::Board::Service. a whole roster of services, main character energy fr fr.

can be coerced from an arrayref of services β€” the keys will be the services' names. obsessed πŸ’…

🧚 "Bread::Board::Service::Dependencies"

hashref mapping strings to instances of Bread::Board::Dependency. and here's where it gets interesting, bestie β€” 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

and 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. cute right? πŸŽ€

🌸 Examples 🌸

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

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

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

here 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 ]". chef's kiss 😭

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. the way that just works? πŸ”₯

⭐ "Bread::Board::Service::Parameters"

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

can be coerced from an arrayref of strings, so like:

[qw(a b c)]

becomes:

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

look at that glow-up πŸ’…βœ¨


πŸ‘‘ AUTHOR πŸ‘‘

Stevan Little <stevan@iinteractive.com> β€” the icon, the moment, the legend πŸ’–


πŸ’€ BUGS πŸ’€

please report any bugs or feature requests on the bugtracker website:

https://github.com/stevan/BreadBoard/issues

and 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 is not optional bestie, it's the vibe πŸ™ˆ


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


okay and that's a wrap on the Bread:...::Types(3pm) page, babes. this was rendered by perl v5.36.0 on 2022-12-12 β€” so like, remember that date when you cite it, k? mwah πŸ’‹

πŸ“¦ where this page comes from