line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::MethodAttributes; # git description: v0.31-13-g5621366 |
2
|
|
|
|
|
|
|
# ABSTRACT: Code attribute introspection |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.32'; |
5
|
|
|
|
|
|
|
|
6
|
21
|
|
|
21
|
|
4971545
|
use Moose (); |
|
21
|
|
|
|
|
3006556
|
|
|
21
|
|
|
|
|
667
|
|
7
|
21
|
|
|
21
|
|
174
|
use Moose::Exporter; |
|
21
|
|
|
|
|
48
|
|
|
21
|
|
|
|
|
189
|
|
8
|
21
|
|
|
21
|
|
992
|
use Moose::Util::MetaRole; |
|
21
|
|
|
|
|
70
|
|
|
21
|
|
|
|
|
623
|
|
9
|
21
|
|
|
21
|
|
121
|
use Moose::Util qw/find_meta does_role/; |
|
21
|
|
|
|
|
52
|
|
|
21
|
|
|
|
|
186
|
|
10
|
|
|
|
|
|
|
# Ensure trait is registered |
11
|
21
|
|
|
21
|
|
18887
|
use MooseX::MethodAttributes::Role::Meta::Role (); |
|
21
|
|
|
|
|
91
|
|
|
21
|
|
|
|
|
1030
|
|
12
|
21
|
|
|
21
|
|
680
|
use namespace::autoclean; |
|
21
|
|
|
|
|
8332
|
|
|
21
|
|
|
|
|
130
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod package MyClass; |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod use Moose; |
19
|
|
|
|
|
|
|
#pod use MooseX::MethodAttributes; |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod sub foo : Bar Baz('corge') { ... } |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod my $attrs = MyClass->meta->get_method('foo')->attributes; # ["Bar", "Baz('corge')"] |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
26
|
|
|
|
|
|
|
#pod |
27
|
|
|
|
|
|
|
#pod This module allows code attributes of methods to be introspected using Moose |
28
|
|
|
|
|
|
|
#pod meta method objects. |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod =begin Pod::Coverage |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod init_meta |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod =end Pod::Coverage |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod =cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( |
39
|
|
|
|
|
|
|
also => 'Moose', |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub init_meta { |
43
|
47
|
|
|
47
|
0
|
23696
|
my ($class, %options) = @_; |
44
|
|
|
|
|
|
|
|
45
|
47
|
|
|
|
|
123
|
my $for_class = $options{for_class}; |
46
|
47
|
|
|
|
|
185
|
my $meta = find_meta($for_class); |
47
|
|
|
|
|
|
|
|
48
|
47
|
50
|
100
|
|
|
696
|
return $meta if $meta |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
49
|
|
|
|
|
|
|
&& does_role($meta, 'MooseX::MethodAttributes::Role::Meta::Class') |
50
|
|
|
|
|
|
|
&& does_role($meta->method_metaclass, 'MooseX::MethodAttributes::Role::Meta::Method') |
51
|
|
|
|
|
|
|
&& does_role($meta->wrapped_method_metaclass, 'MooseX::MethodAttributes::Role::Meta::Method::MaybeWrapped'); |
52
|
|
|
|
|
|
|
|
53
|
22
|
100
|
|
|
|
2974
|
$meta = Moose::Meta::Class->create( $for_class ) |
54
|
|
|
|
|
|
|
unless $meta; |
55
|
|
|
|
|
|
|
|
56
|
22
|
|
|
|
|
11994
|
$meta = Moose::Util::MetaRole::apply_metaroles( |
57
|
|
|
|
|
|
|
for => $for_class, |
58
|
|
|
|
|
|
|
class_metaroles => { |
59
|
|
|
|
|
|
|
class => ['MooseX::MethodAttributes::Role::Meta::Class'], |
60
|
|
|
|
|
|
|
method => ['MooseX::MethodAttributes::Role::Meta::Method'], |
61
|
|
|
|
|
|
|
wrapped_method => [ |
62
|
|
|
|
|
|
|
'MooseX::MethodAttributes::Role::Meta::Method::MaybeWrapped'], |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
22
|
|
|
|
|
106813
|
Moose::Util::MetaRole::apply_base_class_roles( |
67
|
|
|
|
|
|
|
for_class => $for_class, |
68
|
|
|
|
|
|
|
roles => ['MooseX::MethodAttributes::Role::AttrContainer'], |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
22
|
|
|
|
|
57885
|
return $meta; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=pod |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=encoding UTF-8 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
MooseX::MethodAttributes - Code attribute introspection |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 VERSION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
version 0.32 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SYNOPSIS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
package MyClass; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
use Moose; |
95
|
|
|
|
|
|
|
use MooseX::MethodAttributes; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub foo : Bar Baz('corge') { ... } |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $attrs = MyClass->meta->get_method('foo')->attributes; # ["Bar", "Baz('corge')"] |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 DESCRIPTION |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This module allows code attributes of methods to be introspected using Moose |
104
|
|
|
|
|
|
|
meta method objects. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=for Pod::Coverage init_meta |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SUPPORT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-MethodAttributes> |
111
|
|
|
|
|
|
|
(or L<bug-MooseX-MethodAttributes@rt.cpan.org|mailto:bug-MooseX-MethodAttributes@rt.cpan.org>). |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
114
|
|
|
|
|
|
|
L<http://lists.perl.org/list/moose.html>. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
117
|
|
|
|
|
|
|
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHORS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=over 4 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Tomas Doran <bobtfish@bobtfish.net> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=back |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Dave Rolsky Marcus Ramberg Graham Knop Peter E Karman David Steinbrunner |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=over 4 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Marcus Ramberg <marcus@nordaaker.com> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Graham Knop <haarg@haarg.org> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Peter E Karman <pek@dewpoint.msi.umn.edu> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
David Steinbrunner <dsteinbrunner@pobox.com> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=back |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This software is copyright (c) 2009 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 |