6 # FIXME - neither of these work:
7 #use Sub::Exporter -setup => [
20 #use Sub::Exporter -setup => [
23 # Bread::Board::container
24 # Bread::Board::depends_on
25 # Bread::Board::service
27 # Bread::Board::wire_names
28 # Bread::Board::include
29 # Bread::Board::typemap
33 # I'm probably doing it wrong.
34 # Anyway, I'll just use Moose::Exporter. Do I really have to use Sub::Exporter?
36 Moose::Exporter->setup_import_methods(
37 also => ['Bread::Board'],
42 # FIXME - should the code example below be on this file or Catalyst::IOC::Container?
50 Catalyst::IOC - IOC for Catalyst, based on Bread::Board
54 package MyApp::Container;
60 container $self => as {
61 container model => as {
66 # model Bar needs model Foo to be built before
67 # and Bar's constructor gets Foo as a parameter
68 component Bar => ( dependencies => [
69 depends_on('/model/Foo'),
72 # Baz is rebuilt once per HTTP request
73 component Baz => ( lifecycle => 'Request' );
75 # built only once per application life time
76 component Quux => ( lifecycle => 'Singleton' );
78 # built once per app life time and uses an external model,
79 # outside the default directory
80 # no need for wrappers or Catalyst::Model::Adaptor
82 lifecycle => 'Singleton',
83 class => 'My::External::Class',
95 Catalyst Contributors, see Catalyst.pm
103 This library is free software. You can redistribute it and/or modify it under
104 the same terms as Perl itself.