rewrite SugarContainer to be actually sugar
[catagits/Catalyst-Runtime.git] / t / lib / TestAppCustomContainer / SugarContainer.pm
CommitLineData
88cea23c 1package TestAppCustomContainer::SugarContainer;
3ef84846 2use Moose;
88cea23c 3use namespace::autoclean;
4use Catalyst::IOC;
3ef84846 5
6extends 'Catalyst::IOC::Container';
7
8sub 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 371;