line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Declare::Syntax::Keyword::MethodModifier; |
2
|
|
|
|
|
|
|
# ABSTRACT: Handle method modifier declarations |
3
|
|
|
|
|
|
|
$MooseX::Declare::Syntax::Keyword::MethodModifier::VERSION = '0.40'; |
4
|
24
|
|
|
24
|
|
12696
|
use Moose; |
|
24
|
|
|
|
|
34
|
|
|
24
|
|
|
|
|
131
|
|
5
|
24
|
|
|
24
|
|
116338
|
use Moose::Util; |
|
24
|
|
|
|
|
40
|
|
|
24
|
|
|
|
|
129
|
|
6
|
24
|
|
|
24
|
|
2997
|
use Moose::Util::TypeConstraints; |
|
24
|
|
|
|
|
71
|
|
|
24
|
|
|
|
|
163
|
|
7
|
|
|
|
|
|
|
|
8
|
24
|
|
|
24
|
|
35712
|
use namespace::clean -except => 'meta'; |
|
24
|
|
|
|
|
46
|
|
|
24
|
|
|
|
|
185
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
11
|
|
|
|
|
|
|
#pod |
12
|
|
|
|
|
|
|
#pod Allows the implementation of method modification handlers like C<around> and |
13
|
|
|
|
|
|
|
#pod C<before>. |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod =head1 CONSUMES |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod =for :list |
18
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::MethodDeclaration> |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod =cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
with 'MooseX::Declare::Syntax::MethodDeclaration'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#pod =attr modifier_type |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod A required string that is one of: |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod =for :list |
29
|
|
|
|
|
|
|
#pod * around |
30
|
|
|
|
|
|
|
#pod * after |
31
|
|
|
|
|
|
|
#pod * before |
32
|
|
|
|
|
|
|
#pod * override |
33
|
|
|
|
|
|
|
#pod * augment |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod =cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has modifier_type => ( |
38
|
|
|
|
|
|
|
is => 'rw', |
39
|
|
|
|
|
|
|
isa => enum([qw( around after before override augment )]), |
40
|
|
|
|
|
|
|
required => 1, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#pod =method register_method_declaration |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod Object->register_method_declaration (Object $metaclass, Str $name, Object $method) |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod This will add the method modifier to the C<$metaclass> via L<Moose::Util>s |
48
|
|
|
|
|
|
|
#pod C<add_method_modifier>, whose return value will also be returned from this |
49
|
|
|
|
|
|
|
#pod method. |
50
|
|
|
|
|
|
|
#pod |
51
|
|
|
|
|
|
|
#pod =cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub register_method_declaration { |
54
|
14
|
|
|
14
|
1
|
30
|
my ($self, $meta, $name, $method) = @_; |
55
|
14
|
|
|
|
|
588
|
return Moose::Util::add_method_modifier($meta->name, $self->modifier_type, [$name, $method->body]); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
59
|
|
|
|
|
|
|
#pod |
60
|
|
|
|
|
|
|
#pod =for :list |
61
|
|
|
|
|
|
|
#pod * L<MooseX::Declare> |
62
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::MooseSetup> |
63
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::MethodDeclaration> |
64
|
|
|
|
|
|
|
#pod * L<MooseX::Method::Signatures> |
65
|
|
|
|
|
|
|
#pod |
66
|
|
|
|
|
|
|
#pod =cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=encoding UTF-8 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
MooseX::Declare::Syntax::Keyword::MethodModifier - Handle method modifier declarations |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 VERSION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
version 0.40 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DESCRIPTION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Allows the implementation of method modification handlers like C<around> and |
87
|
|
|
|
|
|
|
C<before>. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 modifier_type |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
A required string that is one of: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 4 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
around |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
after |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
before |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
override |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
augment |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=back |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 METHODS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 register_method_declaration |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Object->register_method_declaration (Object $metaclass, Str $name, Object $method) |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This will add the method modifier to the C<$metaclass> via L<Moose::Util>s |
126
|
|
|
|
|
|
|
C<add_method_modifier>, whose return value will also be returned from this |
127
|
|
|
|
|
|
|
method. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 CONSUMES |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=over 4 |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::MethodDeclaration> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=back |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 SEE ALSO |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over 4 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
L<MooseX::Declare> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::MooseSetup> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::MethodDeclaration> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
L<MooseX::Method::Signatures> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHOR |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Florian Ragwitz. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
170
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |