X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=4bd707f3cceb38dcb5e90cb8c3b9b843d344a3f8;hb=6294ce5fb0104bec15e7c30097eb39e236840688;hp=ff5b3cd6335a7fef40608e0e9b39b7d2293e4843;hpb=b873d23a9da6963ac7b8245f6f988341e171060f;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index ff5b3cd..4bd707f 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -64,7 +64,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.7099_02'; +our $VERSION = '5.7099_03'; sub import { my ( $class, @arguments ) = @_; @@ -683,11 +683,13 @@ sub component { if( !ref $name ) { # is it the exact name? - return $comps->{ $name } if exists $comps->{ $name }; + return $c->_filter_component( $comps->{ $name }, @args ) + if exists $comps->{ $name }; # perhaps we just omitted "MyApp"? my $composed = ( ref $c || $c ) . "::${name}"; - return $comps->{ $composed } if exists $comps->{ $composed }; + return $c->_filter_component( $comps->{ $composed }, @args ) + if exists $comps->{ $composed }; # search all of the models, views and controllers my( $comp ) = $c->_comp_search_prefixes( $name, qw/Model M Controller C View V/ ); @@ -698,12 +700,13 @@ sub component { my $query = ref $name ? $name : qr{$name}i; my @result = grep { m{$query} } keys %{ $c->components }; - return @result if ref $name; + return map { $c->_filter_component( $_, @args ) } @result if ref $name; if( $result[ 0 ] ) { + $c->log->warn( qq(Found results for "${name}" using regexp fallback.) ); $c->log->warn( 'Relying on the regexp fallback behavior for component resolution' ); $c->log->warn( 'is unreliable and unsafe. You have been warned' ); - return $result[ 0 ]; + return $c->_filter_component( $result[ 0 ], @args ); } # I would expect to return an empty list here, but that breaks back-compat @@ -785,7 +788,8 @@ L. =head2 $c->path_to(@path) Merges C<@path> with C<< $c->config->{home} >> and returns a -L object. +L object. Must be called after C<< MyApp->setup >>, +which sets up C<< $c->config->{home} >>. For example: