[Catalyst-commits] r7870 - in
Catalyst-Runtime/5.70/branches/compres: . lib
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Fri May 30 14:25:38 BST 2008
Author: bricas
Date: 2008-05-30 14:25:38 +0100 (Fri, 30 May 2008)
New Revision: 7870
Modified:
Catalyst-Runtime/5.70/branches/compres/Changes
Catalyst-Runtime/5.70/branches/compres/lib/Catalyst.pm
Log:
minor change to warning. docs + Changes
Modified: Catalyst-Runtime/5.70/branches/compres/Changes
===================================================================
--- Catalyst-Runtime/5.70/branches/compres/Changes 2008-05-30 12:57:48 UTC (rev 7869)
+++ Catalyst-Runtime/5.70/branches/compres/Changes 2008-05-30 13:25:38 UTC (rev 7870)
@@ -1,6 +1,14 @@
# This file documents the revision history for Perl extension Catalyst.
5.7xxx xxx
+ - Refactored component resolution (component(), models(), model(), et al). We now
+ throw warnings for two reasons:
+ 1) model() or view() was called with no arguments, and two results are returned
+ -- set default_(model|view), current_(model|view) or current_(model|view)_instance
+ instead
+ 2) you call a component resolution method with a string, and it resorts to a regexp
+ fallback wherein a result is returned -- if you really want to search, call the
+ method with a regex as the argument
- Get some of the optional_* tests working from dirs with spaces (RT #26455)
- Fix Catalyst::Utils::home() when application .pm is in the current dir (RT #34437)
Modified: Catalyst-Runtime/5.70/branches/compres/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/compres/lib/Catalyst.pm 2008-05-30 12:57:48 UTC (rev 7869)
+++ Catalyst-Runtime/5.70/branches/compres/lib/Catalyst.pm 2008-05-30 13:25:38 UTC (rev 7870)
@@ -441,8 +441,8 @@
# 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 @@
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 @@
- 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 @@
- 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 @@
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 {
More information about the Catalyst-commits
mailing list