update distar url
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Action.pm
index fd4aa1c..36f4793 100644 (file)
@@ -261,7 +261,7 @@ sub resolve_type_constraint {
     my $tc =  Type::Registry->new->foreign_lookup($name);
     return defined $tc ? $tc : die "'$name' not a full namespace type constraint in ${\$self->private_path}";
   }
-  
+
   my @tc = grep { defined $_ } (eval("package ${\$self->class}; $name"));
 
   unless(scalar @tc) {
@@ -289,10 +289,10 @@ sub resolve_type_constraint {
           } else {
             return;
           }
-        } 
+        }
       }
     }
-    
+
     my $classes = join(',', $self->class, @roles, @supers);
     die "'$name' not a type constraint in '${\$self->private_path}', Looked in: $classes";
   }
@@ -460,6 +460,11 @@ sub compare {
     return $a1->comparable_arg_number <=> $a2->comparable_arg_number;
 }
 
+sub equals {
+  my ($self, $target) = @_;
+  return $self->private_path eq $target->private_path ? $self : 0;
+}
+
 sub scheme {
   return exists $_[0]->attributes->{Scheme} ? $_[0]->attributes->{Scheme}[0] : undef;
 }
@@ -470,7 +475,7 @@ sub list_extra_info {
     Args => $self->normalized_arg_number,
     CaptureArgs => $self->number_of_captures,
   }
-} 
+}
 
 __PACKAGE__->meta->make_immutable;
 
@@ -536,6 +541,12 @@ Tries to find a type constraint if you have on on a type constrained method.
 Compares 2 actions based on the value of the C<Args> attribute, with no C<Args>
 having the highest precedence.
 
+=head2 equals
+
+    if( $action->equal($other_action) ) { ... }
+
+Returns true if the two actions are equal.
+
 =head2 namespace
 
 Returns the private namespace this action lives in.