of L<Moose> attributes.
Most of the accessors to information gathered during compile time (such
-as configuration) are managed by C<Catalyst::ClassData>, which is a
+as configuration) are managed by C<Catalyst::ClassData>, which is a
L<Moose>-aware version of L<Class::Data::Inheritable> but not compatible
with L<MooseX::ClassAttribute>.
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
-
+
=head2 Controller Roles
It is possible to use roles to apply method modifiers on controller actions
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller' };
-
- sub foo : Local {
+
+ sub foo : Local {
my ($self, $c) = @_;
$c->res->body('Hello ');
}
my ($self, $c) = @_;
$c->res->body($c->res->body . 'World');
};
-
+
It is possible to have action methods with attributes inside Moose roles, using
L<MooseX::MethodAttributes>, example:
package MyApp::ControllerRole;
use MooseX::MethodAttributes::Role;
use namespace::autoclean;
-
+
sub foo : Local {
my ($self, $c) = @_;
...
}
-
+
package MyApp::Controller::Foo;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller' };
-
+
with 'MyApp::ControllerRole';
=head1 AUTHORS