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