[Catalyst-commits] r13791 - in Catalyst-Runtime/5.80/branches/psgi: . t/aggregate t/lib/ChainedActionsApp/Controller

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Mon Dec 6 12:12:45 GMT 2010


Author: rafl
Date: 2010-12-06 12:12:45 +0000 (Mon, 06 Dec 2010)
New Revision: 13791

Modified:
   Catalyst-Runtime/5.80/branches/psgi/Changes
   Catalyst-Runtime/5.80/branches/psgi/t/aggregate/live__component_controller_action_chained2.t
   Catalyst-Runtime/5.80/branches/psgi/t/lib/ChainedActionsApp/Controller/Root.pm
Log:
Merge branch 'master' into psgi

* master:
  Improved test about chained actions and add note in Changes.

Modified: Catalyst-Runtime/5.80/branches/psgi/Changes
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/Changes	2010-12-06 12:08:49 UTC (rev 13790)
+++ Catalyst-Runtime/5.80/branches/psgi/Changes	2010-12-06 12:12:45 UTC (rev 13791)
@@ -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/branches/psgi/t/aggregate/live__component_controller_action_chained2.t
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/t/aggregate/live__component_controller_action_chained2.t	2010-12-06 12:08:49 UTC (rev 13790)
+++ Catalyst-Runtime/5.80/branches/psgi/t/aggregate/live__component_controller_action_chained2.t	2010-12-06 12:12:45 UTC (rev 13791)
@@ -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/branches/psgi/t/lib/ChainedActionsApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/t/lib/ChainedActionsApp/Controller/Root.pm	2010-12-06 12:08:49 UTC (rev 13790)
+++ Catalyst-Runtime/5.80/branches/psgi/t/lib/ChainedActionsApp/Controller/Root.pm	2010-12-06 12:12:45 UTC (rev 13791)
@@ -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