X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=a75f43bfe33739b796b343c1e2855eeafea584ac;hb=c2bdae884dfda03d5d7c24c74d59eb24c25855b6;hp=83366f52edbe7e89e0f48aa8c36e708d0f51e7ca;hpb=c49b3de44e34e737e058fc6837719dd9d437edbd;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 83366f5..a75f43b 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -441,8 +441,8 @@ sub _comp_search_prefixes { # don't warn if we didn't find any results, it just might not exist if( @result ) { - $c->log->warn( 'Relying on the regexp fallback behavior for component resolution' ); - $c->log->warn( 'is unreliable and unsafe. You have been warned' ); + $c->log->warn( 'Relying on the regexp fallback behavior for component resolution is unreliable and unsafe.' ); + $c->log->warn( 'If you really want to search, pass in a regexp as the argument.' ); } return @result; @@ -481,6 +481,12 @@ Gets a L instance by name. If the name is omitted, will return the controller for the dispatched action. +If you want to search for controllers, pass in a regexp as the argument. + + # find all controllers that start with Foo + my @foo_controllers = $c->controller(qr{^Foo}); + + =cut sub controller { @@ -509,6 +515,11 @@ If the name is omitted, it will look for - a config setting 'default_model', or - check if there is only one model, and return it if that's the case. +If you want to search for models, pass in a regexp as the argument. + + # find all models that start with Foo + my @foo_models = $c->model(qr{^Foo}); + =cut sub model { @@ -557,6 +568,11 @@ If the name is omitted, it will look for - a config setting 'default_view', or - check if there is only one view, and return it if that's the case. +If you want to search for views, pass in a regexp as the argument. + + # find all views that start with Foo + my @foo_views = $c->view(qr{^Foo}); + =cut sub view { @@ -633,6 +649,9 @@ unless you want to get a specific component by full class. C<< $c->controller >>, C<< $c->model >>, and C<< $c->view >> should be used instead. +If C<$name> is a regexp, a list of components matched against the full +component name will be returned. + =cut sub component {