000a56d414595c32fbb559e7e9f9009621b305b3
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / MooseX / Declare / Syntax / Keyword / Method.pm
1 package MooseX::Declare::Syntax::Keyword::Method;
2
3 use Moose;
4
5 use namespace::clean -except => 'meta';
6
7 with 'MooseX::Declare::Syntax::MethodDeclaration';
8
9 sub register_method_declaration {
10     my ($self, $meta, $name, $method) = @_;
11     return $meta->add_method($name, $method);
12 }
13
14 1;
15
16 __END__
17
18 =head1 NAME
19
20 MooseX::Declare::Syntax::Keyword::Method - Handle method declarations
21
22 =head1 DESCRIPTION
23
24 This role is an extension of L<MooseX::Declare::Syntax::MethodDeclaration>
25 that allows you to install keywords that declare methods.
26
27 =head1 CONSUMES
28
29 =over
30
31 =item * L<MooseX::Declare::Syntax::MethodDeclaration>
32
33 =back
34
35 =head1 METHODS
36
37 =head2 register_method_declaration
38
39   Object->register_method_declaration (Object $metaclass, Str $name, Object $method)
40
41 This method required by the method declaration role will register the finished
42 method object via the C<< $metaclass->add_method >> method.
43
44   MethodModifier->new(
45       identifier           => 'around',
46       modifier_type        => 'around',
47       prototype_injections => {
48           declarator => 'around',
49           injections => [ 'CodeRef $orig' ],
50       },
51   );
52
53 This will mean that the signature C<(Str $foo)> will become
54 C<CodeRef $orig: Object $self, Str $foo> and and C<()> will become
55 C<CodeRef $orig: Object $self>.
56
57 =head1 SEE ALSO
58
59 =over
60
61 =item * L<MooseX::Declare>
62
63 =item * L<MooseX::Declare::Syntax::MooseSetup>
64
65 =item * L<MooseX::Declare::Syntax::MethodDeclaration>
66
67 =item * L<MooseX::Method::Signatures>
68
69 =back
70
71 =head1 AUTHOR, COPYRIGHT & LICENSE
72
73 See L<MooseX::Declare>
74
75 =cut