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