X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;fp=lib%2FCatalyst.pm;h=e6a9f4d8e7bf03dbd1cb4eb579966bb79a62e0c1;hb=1c1bb322fd27968c04987a1b65c0144a99ba7284;hp=ad387c0c9c7325bd035e0163273dba8585901841;hpb=5be6c1d8aa115905e3217fa220c903e950021abc;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index ad387c0..e6a9f4d 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -695,10 +695,6 @@ sub component { my ( $c, $component, @args ) = @_; if ( $component ) { - # FIXME: I probably shouldn't be doing this - return $c->components->{$component} - if exists $c->components->{$component}; - my ($type, $name) = _get_component_type_name($component); if ($type && $c->container->has_sub_container($type)) { @@ -717,10 +713,16 @@ sub component { my @components = $subcontainer->get_service_list; my @result = grep { m{$component} } @components; - return map { $subcontainer->get_component( $_, $c, @args ) } @result; + return map { $subcontainer->get_component( $_, $c, @args ) } @result + if @result; } } + # FIXME: I probably shouldn't be doing this + # I'm keeping it temporarily for things like $c->comp('MyApp') + return $c->components->{$component} + if exists $c->components->{$component} and !@args; + $c->log->warn("Looking for '$component', but nothing was found."); # I would expect to return an empty list here, but that breaks back-compat