setup_components back to method
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 500d286..0cd35b0 100644 (file)
@@ -597,11 +597,11 @@ sub model {
     my ( $c, $name, @args ) = @_;
 
     if (ref $c && !$name) {
-        return $c->stash->{current_model_instance}
-            if $c->stash->{current_model_instance};
+        my $current_instance = $c->stash->{current_model_instance};
+        return $current_instance
+            if $current_instance;
 
-        $name = $c->stash->{current_model}
-            if $c->stash->{current_model};
+        $name = $c->stash->{current_model};
     }
 
     return $c->container->get_component_from_sub_container( 'model', $name, $c, @args);
@@ -633,11 +633,11 @@ sub view {
     my ( $c, $name, @args ) = @_;
 
     if (ref $c && !$name) {
-        return $c->stash->{current_view_instance}
-            if $c->stash->{current_view_instance};
+        my $current_instance = $c->stash->{current_view_instance};
+        return $current_instance
+            if $current_instance;
 
-        $name = $c->stash->{current_view}
-            if $c->stash->{current_view};
+        $name = $c->stash->{current_view};
     }
 
     return $c->container->get_component_from_sub_container( 'view', $name, $c, @args);
@@ -2290,7 +2290,7 @@ sub setup_config {
 
     my $container_class = Class::MOP::load_first_existing_class(@container_classes);
 
-    my $container = $container_class->new( %args, name => "$class" );
+    my $container = $container_class->new( %args, application_name => "$class", name => "$class" );
     $class->container($container);
 
     my $config = $container->resolve(service => 'config');
@@ -2317,10 +2317,7 @@ The C<setup_components> config option is passed to both of the above methods.
 =cut
 
 sub setup_components {
-    my $class = shift;
-    # FIXME - I believe I shouldn't be handing $class over
-    # Just don't know how to solve this.
-    return $class->container->setup_components( $class );
+    shift->container->setup_components();
 }
 
 # FIXME - removed locate_components