fixing _get_component_type_name
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / Container.pm
index a1ca69a..0d39702 100644 (file)
@@ -667,7 +667,9 @@ sub _get_component_type_name {
 
     my @parts = split /::/, $component;
 
-    while (my $type = shift @parts) {
+    while (scalar @parts > 1) {
+        my $type = shift @parts;
+
         return ('controller', join '::', @parts)
             if $type =~ /^(c|controller)$/i;
 
@@ -686,6 +688,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__
@@ -893,6 +908,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