[Catalyst-commits] r13782 - in Catalyst-Runtime/5.80/trunk: .
t/aggregate t/lib/ChainedActionsApp/Controller
ferz at dev.catalyst.perl.org
ferz at dev.catalyst.perl.org
Sun Dec 5 23:08:01 GMT 2010
Author: ferz
Date: 2010-12-05 23:08:01 +0000 (Sun, 05 Dec 2010)
New Revision: 13782
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/t/aggregate/live__component_controller_action_chained2.t
Catalyst-Runtime/5.80/trunk/t/lib/ChainedActionsApp/Controller/Root.pm
Log:
Improved test about chained actions and add note in Changes.
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2010-12-05 23:03:07 UTC (rev 13781)
+++ Catalyst-Runtime/5.80/trunk/Changes 2010-12-05 23:08:01 UTC (rev 13782)
@@ -7,6 +7,13 @@
Bug fixes:
- Deal correctly with GLOB file handles in the response body (setting
the Content-Length header appropriately)
+ - Chained dispatch has been fixed to always prefer paths
+ with the minimum number of captures (rather than the
+ maximum number of actions). This means that (for example)
+ a URI path /foo/* made out of 2 actions will take preference
+ to a URI path /*/* made out of 3 actions. Please check your applications
+ if you are using chained action and please write new test to report
+ failing case.
Documentation:
- Clarify that when forwarding or detaching, the end action associated
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live__component_controller_action_chained2.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live__component_controller_action_chained2.t 2010-12-05 23:03:07 UTC (rev 13781)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live__component_controller_action_chained2.t 2010-12-05 23:08:01 UTC (rev 13782)
@@ -10,12 +10,12 @@
content_like('/', qr/Application Home Page/, 'Application home');
content_like('/15/GoldFinger', qr/List project GoldFinger pages/, 'GoldFinger Project Index');
content_like('/15/GoldFinger/4/007', qr/This is 007 page of GoldFinger project/, '007 page in GoldFinger Project');
-TODO: {
- local $TODO="Bug on precedence of dispatch order of chained actions.";
- content_like('/account', qr/New account o login/, 'no account');
- content_like('/account/ferz', qr/This is account ferz/, 'account');
- content_like('/account/123', qr/This is account 123/, 'account');
-}
+
+content_like('/account', qr/New account o login/, 'no account');
+content_like('/account/ferz', qr/This is account ferz/, 'account');
+content_like('/account/123', qr/This is account 123/, 'account');
+content_like('/account/profile/007/James Bond', qr/This is profile of James Bond/, 'account');
+
action_notfound('/c');
done_testing;
Modified: Catalyst-Runtime/5.80/trunk/t/lib/ChainedActionsApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/ChainedActionsApp/Controller/Root.pm 2010-12-05 23:03:07 UTC (rev 13781)
+++ Catalyst-Runtime/5.80/trunk/t/lib/ChainedActionsApp/Controller/Root.pm 2010-12-05 23:08:01 UTC (rev 13782)
@@ -50,6 +50,16 @@
$c->response->body( "This is account " . $c->stash->{account_id} );
}
+sub profile_base : Chained('setup') PathPart('account/profile') CaptureArgs(1) {
+ my($self,$c,$acc_id) = @_;
+ $c->stash({account_id=>$acc_id});
+}
+
+sub profile : Chained('profile_base') PathPart('') Args(1) {
+ my($self,$c,$acc) = @_;
+ $c->response->body( "This is profile of " . $acc );
+}
+
sub default : Chained('setup') PathPart('') Args() {
my ( $self, $c ) = @_;
$c->response->body( 'Page not found' );
More information about the Catalyst-commits
mailing list