From: Justin Hunter Date: Thu, 19 Aug 2010 16:16:29 +0000 (+0000) Subject: remove more $c->components in favor of Bread::Board X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=176018a7b2f0443f1a3c21e7de2f4f61fd4aa756 remove more $c->components in favor of Bread::Board --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 5a66003..f014f29 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -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" );