X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FAction.pm;h=8e5ea75990178c49fa32edc7f7cdef5febcbd26d;hp=0bc165aa880282d3d6d84665c741a5a1a4da9b35;hb=4082e67814e85bc9820e56eb38e5e21511c0a5f8;hpb=9ce5ab638a3850ea9b2449dc1ed20693f5478973 diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index 0bc165a..8e5ea75 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -3,7 +3,7 @@ package Catalyst::Action; use strict; use base qw/Class::Accessor::Fast/; -__PACKAGE__->mk_accessors(qw/code namespace reverse prefix attributes name/); +__PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/); use overload ( @@ -13,6 +13,9 @@ use overload ( # Codulate to encapsulated action coderef '&{}' => sub { shift->{code} }, + # Make general $stuff still work + fallback => 1, + ); =head1 NAME @@ -27,28 +30,37 @@ See L. =head1 METHODS -=over 4 +=head2 attributes -=item attributes +=head2 class -=item code +=head2 code -=item execute +=head2 execute =cut sub execute { # Execute ourselves against a context my ( $self, $c ) = @_; - return $c->execute( $self->namespace, $self ); + local $c->namespace = $self->namespace; + return $c->execute( $self->class, $self ); } -=item namespace +=head2 match + +=cut + +sub match { + my ( $self, $c ) = @_; + return 1 unless exists $self->attributes->{Args}; + return scalar(@{$c->req->args}) == $self->attributes->{Args}[0]; +} -=item reverse +=head2 namespace -=item name +=head2 reverse -=back +=head2 name =head1 AUTHOR