- Made Action accessor names more consistent (namespace -> class, prefix -> namespace)
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Action.pm
1 package Catalyst::Action;
2
3 use strict;
4 use base qw/Class::Accessor::Fast/;
5
6 __PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/);
7
8 use overload (
9
10     # Stringify to reverse for debug output etc.
11     q{""} => sub { shift->{reverse} },
12
13     # Codulate to encapsulated action coderef
14     '&{}' => sub { shift->{code} },
15
16 );
17
18 =head1 NAME
19
20 Catalyst::Action - Catalyst Action
21
22 =head1 SYNOPSIS
23
24 See L<Catalyst>.
25
26 =head1 DESCRIPTION
27
28 =head1 METHODS
29
30 =over 4
31
32 =item attributes
33
34 =item class
35
36 =item code
37
38 =item execute
39
40 =cut
41
42 sub execute {    # Execute ourselves against a context
43     my ( $self, $c ) = @_;
44     return $c->execute( $self->class, $self );
45 }
46
47 =item namespace
48
49 =item reverse
50
51 =item name
52
53 =back
54
55 =head1 AUTHOR
56
57 Matt S. Trout
58
59 =head1 COPYRIGHT
60
61 This program is free software, you can redistribute it and/or modify it under
62 the same terms as Perl itself.
63
64 =cut
65
66 1;