- Added missing fallback to Catalyst::Action as spotted by Frank Wiegand
[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     # Make general $stuff still work
17     fallback => 1,
18
19 );
20
21 =head1 NAME
22
23 Catalyst::Action - Catalyst Action
24
25 =head1 SYNOPSIS
26
27 See L<Catalyst>.
28
29 =head1 DESCRIPTION
30
31 =head1 METHODS
32
33 =head2 attributes
34
35 =head2 class
36
37 =head2 code
38
39 =head2 execute
40
41 =cut
42
43 sub execute {    # Execute ourselves against a context
44     my ( $self, $c ) = @_;
45     local $c->namespace = $self->namespace;
46     return $c->execute( $self->class, $self );
47 }
48
49 =head2 namespace
50
51 =head2 reverse
52
53 =head2 name
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;