[Catalyst-commits] r10725 - Catalyst-Runtime/5.80/trunk/lib/Catalyst

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Mon Jun 29 16:49:44 GMT 2009


Author: caelum
Date: 2009-06-29 16:49:44 +0000 (Mon, 29 Jun 2009)
New Revision: 10725

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
Log:
remove Action::sort_order

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm	2009-06-29 11:55:22 UTC (rev 10724)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm	2009-06-29 16:49:44 UTC (rev 10725)
@@ -73,22 +73,18 @@
     return scalar( @{ $c->req->args } ) == $args;
 }
 
-sub sort_order {
-    my $self = shift;
+sub compare {
+    my ($a1, $a2) = @_;
 
-    my ($args) = @{ $self->attributes->{Args} || [] };
+    my ($a1_args) = @{ $a1->attributes->{Args} || [] };
+    my ($a2_args) = @{ $a2->attributes->{Args} || [] };
 
-    return $args if looks_like_number($args);
+    $_ = looks_like_number($_) ? $_ : ~0 
+        for $a1_args, $a2_args;
 
-    return ~0;
+    return $a1_args <=> $a2_args;
 }
 
-sub compare {
-    my ($a1, $a2) = @_;
-
-    return $a1->sort_order <=> $a2->sort_order;
-}
-
 __PACKAGE__->meta->make_immutable;
 
 1;
@@ -124,13 +120,10 @@
 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 >> .
+Compares 2 actions based on the value of the C<Args> attribute, with no C<Args>
+having the highest precedence.
 
 =head2 namespace
 




More information about the Catalyst-commits mailing list