remove more $c->components in favor of Bread::Board
Justin Hunter [Thu, 19 Aug 2010 16:16:29 +0000 (16:16 +0000)]
lib/Catalyst.pm

index 5a66003..f014f29 100644 (file)
@@ -655,9 +655,8 @@ sub controller {
     my $appclass = ref($c) || $c;
     if( $name ) {
         unless ( ref($name) ) { # Direct component hash lookup to avoid costly regexps
-            my $comps = $c->components;
             my $check = $appclass."::Controller::".$name;
-            return $c->_filter_component( $comps->{$check}, @args ) if exists $comps->{$check};
+            return $c->_filter_component( $c->container->get_sub_container('controller')->get_service($check)->get, @args ) if $c->container->get_sub_container('controller')->has_service($check);
         }
         my @result = $c->_comp_search_prefixes( $name, qw/Controller C/ );
         return map { $c->_filter_component( $_, @args ) } @result if ref $name;
@@ -693,9 +692,8 @@ sub model {
     my $appclass = ref($c) || $c;
     if( $name ) {
         unless ( ref($name) ) { # Direct component hash lookup to avoid costly regexps
-            my $comps = $c->components;
             my $check = $appclass."::Model::".$name;
-            return $c->_filter_component( $comps->{$check}, @args ) if exists $comps->{$check};
+            return $c->_filter_component( $c->container->get_sub_container('model')->get_service($check)->get, @args ) if $c->container->get_sub_container('model')->has_service($check);
         }
         my @result = $c->_comp_search_prefixes( $name, qw/Model M/ );
         return map { $c->_filter_component( $_, @args ) } @result if ref $name;
@@ -752,10 +750,10 @@ sub view {
     my $appclass = ref($c) || $c;
     if( $name ) {
         unless ( ref($name) ) { # Direct component hash lookup to avoid costly regexps
-            my $comps = $c->components;
             my $check = $appclass."::View::".$name;
-            if( exists $comps->{$check} ) {
-                return $c->_filter_component( $comps->{$check}, @args );
+            if ($c->container->get_sub_container('view')->has_service($check)) {
+
+                return $c->_filter_component( $c->container->get_sub_container('view')->get_service($check)->get, @args );
             }
             else {
                 $c->log->warn( "Attempted to use view '$check', but does not exist" );