Commit | Line | Data |
88cea23c |
1 | package TestAppCustomContainer::SugarContainer; |
3ef84846 |
2 | use Moose; |
88cea23c |
3 | use namespace::autoclean; |
4 | use Catalyst::IOC; |
3ef84846 |
5 | |
6 | extends 'Catalyst::IOC::Container'; |
7 | |
8 | sub BUILD { |
9 | my $self = shift; |
b18a77bd |
10 | |
1e1434d1 |
11 | container $self => as { |
12 | container model => as { |
13 | component Foo => (); |
14 | component Bar => ( dependencies => [ depends_on('/model/Foo') ] ); |
15 | component Baz => ( |
16 | lifecycle => '+Catalyst::IOC::LifeCycle::Request', |
17 | dependencies => [ |
18 | depends_on( '/application_name' ), |
19 | depends_on( '/config' ), |
20 | depends_on( '/model/Foo' ), |
21 | ], |
22 | ); |
23 | component Quux => ( lifecycle => 'Singleton' ); |
24 | component Fnar => ( |
25 | lifecycle => 'Singleton', |
26 | class => 'My::External::Class', |
27 | dependencies => [ depends_on('config') ], |
28 | # ^^ FIXME - gets whole config, not Model::Foo |
29 | # There should be a 'nice' way to get the 'standard' config |
30 | ); |
31 | }; |
32 | }; |
3ef84846 |
33 | } |
34 | |
88cea23c |
35 | __PACKAGE__->meta->make_immutable; |
36 | |
3ef84846 |
37 | 1; |