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