X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=46d0e8b885b6c0f595fcc4a6b556d3cbbeaf72ba;hb=e10b40fdbf404819d60169dee88175777d1bf109;hp=29637225f628e80b8fca4ccd0a10296788386461;hpb=5a53ef3ddf982a23c517e4cea657ae678a73bffe;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 2963722..46d0e8b 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -557,15 +557,9 @@ If you want to search for controllers, pass in a regexp as the argument. sub controller { my ( $c, $name, @args ) = @_; - my $container = $c->container->get_sub_container('controller'); - if( $name ) { - # Direct component hash lookup to avoid costly regexps - return $container->get_component( $name, $c, @args ) - if $container->has_service($name) && !ref $name; - - return $container->get_component_regexp( $name, $c, @args ); - } + return $c->container->get_component_from_sub_container( 'controller', $name, $c, @args) + if( $name ); return $c->component( $c->action->class ); } @@ -596,13 +590,8 @@ sub model { my $appclass = ref($c) || $c; my $container = $c->container->get_sub_container('model'); - if( $name ) { - # Direct component hash lookup to avoid costly regexps - return $container->get_component( $name, $c, @args ) - if $container->has_service($name) && !ref $name; - - return $container->get_component_regexp( $name, $c, @args ); - } + return $c->container->get_component_from_sub_container( 'model', $name, $c, @args) + if( $name ); if (ref $c) { return $c->stash->{current_model_instance} @@ -654,15 +643,8 @@ sub view { my $appclass = ref($c) || $c; my $container = $c->container->get_sub_container('view'); - if( $name ) { - # Direct component hash lookup to avoid costly regexps - return $container->get_component( $name, $c, @args ) - if !ref $name && $container->has_service($name); - - $c->log->warn( "Attempted to use view '$name', but does not exist" ); - - return $container->get_component_regexp( $name, $c, @args ); - } + return $c->container->get_component_from_sub_container( 'view', $name, $c, @args) + if( $name ); if (ref $c) { return $c->stash->{current_view_instance}