1 package Catalyst::Action;
4 use base qw/Class::Accessor::Fast/;
6 __PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/);
10 # Stringify to reverse for debug output etc.
11 q{""} => sub { shift->{reverse} },
13 # Codulate to encapsulated action coderef
14 '&{}' => sub { shift->{code} },
16 # Make general $stuff still work
23 Catalyst::Action - Catalyst Action
31 This class represents a Catalyst Action. You can access the object for the
32 currently dispatched action via $c->action
38 The sub attributes that are set for this action, like Local, Path, Private
43 Returns the class name of this action
47 Returns a code reference to this action
51 Execute this action against a context
55 sub execute { # Execute ourselves against a context
56 my ( $self, $c ) = @_;
57 local $c->namespace = $self->namespace;
58 return $c->execute( $self->class, $self );
63 Check Args attribute, and makes sure number of args matches the setting.
68 my ( $self, $c ) = @_;
69 return 1 unless exists $self->attributes->{Args};
70 return scalar(@{$c->req->args}) == $self->attributes->{Args}[0];
75 Returns the private namespace this action lives in.
79 Returns the private path for this action.
83 returns the sub name of this action.
91 This program is free software, you can redistribute it and/or modify it under
92 the same terms as Perl itself.