Extending TestAppCustomContainer (without sugar)
[catagits/Catalyst-Runtime.git] / t / lib / TestAppCustomContainer / SugarContainer.pm
1 package TestAppCustomContainer::SugarContainer;
2 use Moose;
3 use namespace::autoclean;
4 use Catalyst::IOC;
5
6 extends 'Catalyst::IOC::Container';
7
8 sub BUILD {
9     my $self = shift;
10
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     };
33 }
34
35 __PACKAGE__->meta->make_immutable;
36
37 1;