3 class CatalystX::Declare::Keyword::Role
4 extends MooseX::Declare::Syntax::Keyword::Role {
7 use aliased 'MooseX::MethodAttributes::Role::Meta::Role';
8 use aliased 'CatalystX::Declare::Keyword::Action', 'ActionKeyword';
11 before add_namespace_customizations (Object $ctx, Str $package) {
13 $ctx->add_preamble_code_parts(
15 'use Moose::Role -traits => q(MethodAttributes)',
19 around default_inner {
21 my @modifiers = qw( );
24 ( grep { my $id = $_->identifier; not grep { $id eq $_ } @modifiers } @{ $self->$orig() || [] } ),
25 ActionKeyword->new(identifier => 'action'),
26 ActionKeyword->new(identifier => 'under'),
27 ActionKeyword->new(identifier => 'final'),
36 CatalystX::Declare::Keyword::Role - Declare Catalyst Controller Roles
40 use CatalystX::Declare;
42 controller_role MyApp::Web::ControllerRole::Foo {
44 method provided_method { ... }
46 action foo, under base, is final { ... }
48 around bar_action (Object $ctx) { ... }
53 This handler provides the C<controller_role> keyword. It is an extension of the
54 L<MooseX::Declare::Syntax::Keyword::Role> handler. Like with declared
55 controllers, the C<method> keyword and the modifiers are provided. For details
56 on the syntax for action declarations have a look at
57 L<CatalystX::Declare::Keyword::Action>, which also documents the effects of
58 method modifiers on actions.
64 =item L<MooseX::Declare::Syntax::Keyword::Role>
70 =head2 add_namespace_customizations
72 Object->add_namespace_customizations (Object $ctx, Str $package)
74 This hook is called by L<MooseX::Declare> and will set the package up as a role
75 and apply L<MooseX::MethodAttributes>.
79 ArrayRef[Object] Object->default_inner ()
81 Same as L<CatalystX::Declare::Keyword::Class/default_inner>.
87 =item L<CatalystX::Declare>
89 =item L<MooseX::Declare/role>
91 =item L<CatalystX::Declare::Keyword::Action>
93 =item L<CatalystX::Declare::Keyword::Controller>
99 See L<CatalystX::Declare/AUTHOR> for author information.
103 This program is free software; you can redistribute it and/or modify it under
104 the same terms as perl itself.