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 foo => depends_on('/model/DefaultSetup'),
40 # $self->get_sub_container('model')->add_service(
41 # Catalyst::IOC::BlockInjection->new(
43 # lifecycle => 'Singleton',
45 # depends_on( '/component/model_Quux' ),
47 # block => sub { shift->param('model_Bar') },
51 # my $fnar_config = $self->resolve(service => 'config')->{'Model::Fnar'} || {};
52 # $self->get_sub_container('component')->add_service(
53 # Catalyst::IOC::ConstructorInjection->new(
54 # name => 'model_Fnar',
55 # lifecycle => 'Singleton',
56 # class => 'TestAppCustomContainer::External::Class',
58 # depends_on( '/application_name' ),
60 # config => $fnar_config,
63 # $self->get_sub_container('model')->add_service(
64 # Catalyst::IOC::BlockInjection->new(
65 # name => 'model_Fnar',
66 # lifecycle => 'Singleton',
68 # depends_on( '/config' ),
69 # depends_on( '/component/model_Fnar' ),
71 # block => sub { shift->param('model_Fnar') },
76 __PACKAGE__->meta->make_immutable;