1 package TestAppCustomContainer::NoSugarContainer;
3 use namespace::autoclean;
6 extends 'Catalyst::IOC::Container';
11 warn("Add SingletonLifeCycle to model");
12 $self->get_sub_container('model')->add_service(
13 Catalyst::IOC::ConstructorInjection->new(
14 name => 'SingletonLifeCycle',
15 lifecycle => 'Singleton',
16 class => 'TestAppCustomContainer::Model::SingletonLifeCycle',
17 catalyst_component_name => 'TestAppCustomContainer::Model::SingletonLifeCycle',
19 application_name => depends_on( '/application_name' ),
20 foo => depends_on('/model/DefaultSetup'),
25 warn("Add RequestLifeCycle to model");
26 $self->get_sub_container('model')->add_service(
27 Catalyst::IOC::ConstructorInjection->new(
28 name => 'RequestLifeCycle',
29 lifecycle => '+Catalyst::IOC::LifeCycle::Request',
30 class => 'TestAppCustomContainer::Model::RequestLifeCycle',
31 catalyst_component_name => 'TestAppCustomContainer::Model::RequestLifeCycle',
33 application_name => depends_on( '/application_name' ),
34 # FIXME - this is what is blowing up everything:
35 # DefaultSetup needs the context. It's not getting it here!
36 foo => depends_on('/model/DefaultSetup'),
42 # $self->get_sub_container('model')->add_service(
43 # Catalyst::IOC::BlockInjection->new(
45 # lifecycle => 'Singleton',
47 # depends_on( '/component/model_Quux' ),
49 # block => sub { shift->param('model_Bar') },
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',
60 # depends_on( '/application_name' ),
62 # config => $fnar_config,
65 # $self->get_sub_container('model')->add_service(
66 # Catalyst::IOC::BlockInjection->new(
67 # name => 'model_Fnar',
68 # lifecycle => 'Singleton',
70 # depends_on( '/config' ),
71 # depends_on( '/component/model_Fnar' ),
73 # block => sub { shift->param('model_Fnar') },
78 __PACKAGE__->meta->make_immutable;