update TODO
[catagits/Catalyst-Runtime.git] / t / lib / TestAppCustomContainer / NoSugarContainer.pm
CommitLineData
88cea23c 1package TestAppCustomContainer::NoSugarContainer;
3ef84846 2use Moose;
88cea23c 3use namespace::autoclean;
4use Catalyst::IOC;
3ef84846 5
6extends 'Catalyst::IOC::Container';
7
8sub BUILD {
9 my $self = shift;
f831deb1 10
a5f37ed6 11 warn("Add SingletonLifeCycle to model");
ced6f9e2 12 $self->get_sub_container('model')->add_service(
13 Catalyst::IOC::ConstructorInjection->new(
04189a0f 14 name => 'SingletonLifeCycle',
a0475a83 15 lifecycle => 'Singleton',
04189a0f 16 class => 'TestAppCustomContainer::Model::SingletonLifeCycle',
17 catalyst_component_name => 'TestAppCustomContainer::Model::SingletonLifeCycle',
a0475a83 18 dependencies => {
19 application_name => depends_on( '/application_name' ),
b32d8169 20 foo => depends_on('/model/DefaultSetup'),
f831deb1 21 },
22 )
23 );
24
576d8ab8 25 warn("Add RequestLifeCycle to model");
a5f37ed6 26 $self->get_sub_container('model')->add_service(
a5f37ed6 27 Catalyst::IOC::ConstructorInjection->new(
54f4b8d1 28 name => 'RequestLifeCycle',
a5f37ed6 29 lifecycle => '+Catalyst::IOC::LifeCycle::Request',
54f4b8d1 30 class => 'TestAppCustomContainer::Model::RequestLifeCycle',
576d8ab8 31 catalyst_component_name => 'TestAppCustomContainer::Model::RequestLifeCycle',
a5f37ed6 32 dependencies => {
33 application_name => depends_on( '/application_name' ),
94e35f00 34 # FIXME - this is what is blowing up everything:
35 # DefaultSetup needs the context. It's not getting it here!
a5f37ed6 36 foo => depends_on('/model/DefaultSetup'),
37 },
38 )
39 );
f831deb1 40
b32d8169 41# Broken deps!?!
42# $self->get_sub_container('model')->add_service(
43# Catalyst::IOC::BlockInjection->new(
44# name => 'Quux',
45# lifecycle => 'Singleton',
46# dependencies => [
47# depends_on( '/component/model_Quux' ),
48# ],
49# block => sub { shift->param('model_Bar') },
50# )
51# );
f831deb1 52
576d8ab8 53# my $fnar_config = $self->resolve(service => 'config')->{'Model::Fnar'} || {};
54# $self->get_sub_container('component')->add_service(
55# Catalyst::IOC::ConstructorInjection->new(
56# name => 'model_Fnar',
57# lifecycle => 'Singleton',
58# class => 'TestAppCustomContainer::External::Class',
59# dependencies => [
60# depends_on( '/application_name' ),
61# ],
62# config => $fnar_config,
63# )
64# );
65# $self->get_sub_container('model')->add_service(
66# Catalyst::IOC::BlockInjection->new(
67# name => 'model_Fnar',
68# lifecycle => 'Singleton',
69# dependencies => [
70# depends_on( '/config' ),
71# depends_on( '/component/model_Fnar' ),
72# ],
73# block => sub { shift->param('model_Fnar') },
74# )
75# );
3ef84846 76}
77
88cea23c 78__PACKAGE__->meta->make_immutable;
79
3ef84846 801;