From: André Walker Date: Wed, 13 Jul 2011 00:12:09 +0000 (-0300) Subject: removed a little bit of repetition, and commented X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=2af0c5847de5fa789e09f50ceb2b54aaebd6913e removed a little bit of repetition, and commented --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 1a8990a..37371ab 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -718,10 +718,7 @@ sub component { my ( $c, $component, @args ) = @_; return sort keys %{ $c->components } - unless ( $component ); - - return $c->_find_component( $component, @args ) - if ref $component; + unless $component; my ($type, $name) = _get_component_type_name($component); @@ -730,6 +727,11 @@ sub component { ) if $type; my @result = $c->_find_component( $component, @args ); + + # list context for regexp searches + return @result if ref $component; + + # only one component (if it's found) for string searches return shift @result if @result; # FIXME: I probably shouldn't be doing this