File Coverage

blib/lib/MooseX/Declare/Syntax/Keyword/Method.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 12 12 100.0


line stmt bran cond sub pod time code
1             package MooseX::Declare::Syntax::Keyword::Method;
2             # ABSTRACT: Handle method declarations
3             $MooseX::Declare::Syntax::Keyword::Method::VERSION = '0.39';
4 24     24   22145 use Moose;
  24         65  
  24         215  
5              
6 24     24   210055 use namespace::clean -except => 'meta';
  24         71  
  24         293  
7              
8             #pod =head1 DESCRIPTION
9             #pod
10             #pod This role is an extension of L<MooseX::Declare::Syntax::MethodDeclaration>
11             #pod that allows you to install keywords that declare methods.
12             #pod
13             #pod =head1 CONSUMES
14             #pod
15             #pod =for :list
16             #pod * L<MooseX::Declare::Syntax::MethodDeclaration>
17             #pod
18             #pod =cut
19              
20             with 'MooseX::Declare::Syntax::MethodDeclaration';
21              
22             #pod =method register_method_declaration
23             #pod
24             #pod Object->register_method_declaration (Object $metaclass, Str $name, Object $method)
25             #pod
26             #pod This method required by the method declaration role will register the finished
27             #pod method object via the C<< $metaclass->add_method >> method.
28             #pod
29             #pod MethodModifier->new(
30             #pod identifier => 'around',
31             #pod modifier_type => 'around',
32             #pod prototype_injections => {
33             #pod declarator => 'around',
34             #pod injections => [ 'CodeRef $orig' ],
35             #pod },
36             #pod );
37             #pod
38             #pod This will mean that the signature C<(Str $foo)> will become
39             #pod C<CodeRef $orig: Object $self, Str $foo> and and C<()> will become
40             #pod C<CodeRef $orig: Object $self>.
41             #pod
42             #pod =cut
43              
44             sub register_method_declaration {
45 39     39 1 118 my ($self, $meta, $name, $method) = @_;
46 39         405 return $meta->add_method($name, $method);
47             }
48              
49             #pod =head1 SEE ALSO
50             #pod
51             #pod =for :list
52             #pod * L<MooseX::Declare>
53             #pod * L<MooseX::Declare::Syntax::MooseSetup>
54             #pod * L<MooseX::Declare::Syntax::MethodDeclaration>
55             #pod * L<MooseX::Method::Signatures>
56             #pod
57             #pod =cut
58              
59             1;
60              
61             __END__
62              
63             =pod
64              
65             =encoding UTF-8
66              
67             =head1 NAME
68              
69             MooseX::Declare::Syntax::Keyword::Method - Handle method declarations
70              
71             =head1 VERSION
72              
73             version 0.39
74              
75             =head1 DESCRIPTION
76              
77             This role is an extension of L<MooseX::Declare::Syntax::MethodDeclaration>
78             that allows you to install keywords that declare methods.
79              
80             =head1 METHODS
81              
82             =head2 register_method_declaration
83              
84             Object->register_method_declaration (Object $metaclass, Str $name, Object $method)
85              
86             This method required by the method declaration role will register the finished
87             method object via the C<< $metaclass->add_method >> method.
88              
89             MethodModifier->new(
90             identifier => 'around',
91             modifier_type => 'around',
92             prototype_injections => {
93             declarator => 'around',
94             injections => [ 'CodeRef $orig' ],
95             },
96             );
97              
98             This will mean that the signature C<(Str $foo)> will become
99             C<CodeRef $orig: Object $self, Str $foo> and and C<()> will become
100             C<CodeRef $orig: Object $self>.
101              
102             =head1 CONSUMES
103              
104             =over 4
105              
106             =item *
107              
108             L<MooseX::Declare::Syntax::MethodDeclaration>
109              
110             =back
111              
112             =head1 SEE ALSO
113              
114             =over 4
115              
116             =item *
117              
118             L<MooseX::Declare>
119              
120             =item *
121              
122             L<MooseX::Declare::Syntax::MooseSetup>
123              
124             =item *
125              
126             L<MooseX::Declare::Syntax::MethodDeclaration>
127              
128             =item *
129              
130             L<MooseX::Method::Signatures>
131              
132             =back
133              
134             =head1 AUTHOR
135              
136             Florian Ragwitz <rafl@debian.org>
137              
138             =head1 COPYRIGHT AND LICENSE
139              
140             This software is copyright (c) 2008 by Florian Ragwitz.
141              
142             This is free software; you can redistribute it and/or modify it under
143             the same terms as the Perl 5 programming language system itself.
144              
145             =cut