[Catalyst-commits] r10604 - in Catalyst-Runtime/5.80/branches/index_default_fuckage: lib/Catalyst lib/Catalyst/DispatchType t/aggregate t/lib/TestAppIndexDefault/Controller

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sat Jun 20 17:18:55 GMT 2009


Author: caelum
Date: 2009-06-20 17:18:53 +0000 (Sat, 20 Jun 2009)
New Revision: 10604

Added:
   Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/Root.pm
Removed:
   Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/DefaultAndPath.pm
Modified:
   Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Action.pm
   Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/DispatchType/Path.pm
   Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/live_component_controller_action_index_or_default.t
Log:
minor changes

Modified: Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Action.pm	2009-06-20 15:22:00 UTC (rev 10603)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Action.pm	2009-06-20 17:18:53 UTC (rev 10604)
@@ -124,6 +124,14 @@
 Check Args attribute, and makes sure number of args matches the setting.
 Always returns true if Args is omitted.
 
+=head2 sort_order
+
+Returns the value of the C<Args> attribute, or C<~0> if it has no value.
+
+=head2 compare
+
+Returns C<< $a->sort_order <=> $b->sort_order >> .
+
 =head2 namespace
 
 Returns the private namespace this action lives in.

Modified: Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/DispatchType/Path.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/DispatchType/Path.pm	2009-06-20 15:22:00 UTC (rev 10603)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/DispatchType/Path.pm	2009-06-20 17:18:53 UTC (rev 10604)
@@ -74,7 +74,9 @@
 
     $path = '/' if !defined $path || !length $path;
 
-    foreach my $action ( @{ $self->_paths->{$path} || [] } ) {
+    my @actions = @{ $self->_paths->{$path} || [] };
+
+    foreach my $action ( @actions ) {
         next unless $action->match($c);
         $c->req->action($path);
         $c->req->match($path);
@@ -115,10 +117,10 @@
     $path = '/' unless length $path;
     $path = URI->new($path)->canonical;
 
-    unshift( @{ $self->_paths->{$path} ||= [] }, $action);
+    $self->_paths->{$path} = [
+        sort { $a <=> $b } ($action, @{ $self->_paths->{$path} || [] })
+    ];
 
-    $self->_paths->{$path} = [ sort @{ $self->_paths->{$path} } ];
-
     return 1;
 }
 

Modified: Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/live_component_controller_action_index_or_default.t
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/live_component_controller_action_index_or_default.t	2009-06-20 15:22:00 UTC (rev 10603)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/live_component_controller_action_index_or_default.t	2009-06-20 17:18:53 UTC (rev 10604)
@@ -27,6 +27,5 @@
 sub run_tests {
     is(get('/indexchained'), 'index_chained', ':Chained overrides index');
     is(get('/indexprivate'), 'index_private', 'index : Private still works');
-    is(get('/defaultandpath/path_one_arg'), 'path_one_arg',
-        'Path overrides default');
+    is(get('/one_arg'), 'path_one_arg', ':Path overrides default');
 }

Deleted: Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/DefaultAndPath.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/DefaultAndPath.pm	2009-06-20 15:22:00 UTC (rev 10603)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/DefaultAndPath.pm	2009-06-20 17:18:53 UTC (rev 10604)
@@ -1,15 +0,0 @@
-package TestAppIndexDefault::Controller::DefaultAndPath;
-
-use base 'Catalyst::Controller';
-
-sub default : Private {
-    my ($self, $c) = @_;
-    $c->res->body('default');
-}
-
-sub path_one_arg : Path('/') Args(1) {
-    my ($self, $c) = @_;
-    $c->res->body('path_one_arg');
-}
-
-1;

Added: Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/Root.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestAppIndexDefault/Controller/Root.pm	2009-06-20 17:18:53 UTC (rev 10604)
@@ -0,0 +1,17 @@
+package TestAppIndexDefault::Controller::Root;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub default : Private {
+    my ($self, $c) = @_;
+    $c->res->body('default');
+}
+
+sub path_one_arg : Path('/') Args(1) {
+    my ($self, $c) = @_;
+    $c->res->body('path_one_arg');
+}
+
+1;




More information about the Catalyst-commits mailing list