Added Catalyst::IOC::LifeCycle::Request
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / Container.pm
index 4c99cd8..c4c8b5a 100644 (file)
@@ -472,9 +472,6 @@ sub setup_components {
                 unless $comps{$component};
         }
     }
-
-    $self->get_sub_container('model')->make_single_default;
-    $self->get_sub_container('view')->make_single_default;
 }
 
 sub _fix_syntax {
@@ -603,25 +600,6 @@ sub find_component_regexp {
     return @result;
 }
 
-# FIXME - t0m, how do you feel about this name?
-# also, do you think I should draw it here, or just return the data structure?
-sub get_components_names_types {
-    my ( $self ) = @_;
-    my @comps_names_types;
-
-    for my $sub_container_name (qw/model view controller/) {
-        my $sub_container = $self->get_sub_container($sub_container_name);
-        for my $service ( $sub_container->get_service_list ) {
-            my $comp     = $sub_container->resolve(service => $service);
-            my $compname = ref $comp || $comp;
-            my $type     = ref $comp ? 'instance' : 'class';
-            push @comps_names_types, [ $compname, $type ];
-        }
-    }
-
-    return @comps_names_types;
-}
-
 sub get_all_components {
     my $self = shift;
     my %components;
@@ -708,6 +686,19 @@ sub expand_component_module {
     return Devel::InnerPackage::list_packages( $module );
 }
 
+# copied from stevan's OX
+sub flush_request_services {
+    my $self = shift;
+    my @services = $self->get_service_list;
+
+    foreach my $service (@services) {
+        my $injection = $self->get_service($service);
+        if ($injection->does('Catalyst::IOC::LifeCycle::Request')) {
+            $injection->flush_instance;
+        }
+    }
+}
+
 1;
 
 __END__
@@ -745,8 +736,7 @@ Same as L<build_model_subcontainer>, but for views.
 
 =head2 build_controller_subcontainer
 
-Same as L<build_model_subcontainer>, but for controllers. The difference is
-that there is no ACCEPT_CONTEXT for controllers.
+Same as L<build_model_subcontainer>, but for controllers.
 
 =head1 Building Services
 
@@ -782,12 +772,14 @@ C<__DATA__> as a config value, for example)
 
 The parameter list is split on comma (C<,>). You can override this method to
 do your own string munging, or you can define your own macros in
-C<MyApp-E<gt>config-E<gt>{ 'Plugin::ConfigLoader' }-E<gt>{ substitutions }>.
+C<< <MyApp->config( 'Plugin::ConfigLoader' => { substitutions => { ... } } ) >>.
 Example:
 
-    MyApp->config->{ 'Plugin::ConfigLoader' }->{ substitutions } = {
-        baz => sub { my $c = shift; qux( @_ ); }
-    }
+    MyApp->config( 'Plugin::ConfigLoader' => {
+        substitutions => {
+            baz => sub { my $c = shift; qux( @_ ); },
+        },
+    });
 
 The above will respond to C<__baz(x,y)__> in config strings.
 
@@ -914,6 +906,8 @@ Finds components that match a given regexp. Used internally, by find_component.
 Components found by C<locate_components> will be passed to this method, which
 is expected to return a list of component (package) names to be set up.
 
+=head2 flush_request_services
+
 =head2 setup_components
 
 =head1 AUTHORS