line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::MethodAttributes; # git description: v0.29-26-ga5bac5b |
2
|
|
|
|
|
|
|
# ABSTRACT: Code attribute introspection |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
5
|
|
|
|
|
|
|
|
6
|
21
|
|
|
21
|
|
4641498
|
use Moose (); |
|
21
|
|
|
|
|
2668761
|
|
|
21
|
|
|
|
|
600
|
|
7
|
21
|
|
|
21
|
|
140
|
use Moose::Exporter; |
|
21
|
|
|
|
|
44
|
|
|
21
|
|
|
|
|
184
|
|
8
|
21
|
|
|
21
|
|
1148
|
use Moose::Util::MetaRole; |
|
21
|
|
|
|
|
39
|
|
|
21
|
|
|
|
|
614
|
|
9
|
21
|
|
|
21
|
|
102
|
use Moose::Util qw/find_meta does_role/; |
|
21
|
|
|
|
|
38
|
|
|
21
|
|
|
|
|
179
|
|
10
|
|
|
|
|
|
|
# Ensure trait is registered |
11
|
21
|
|
|
21
|
|
20445
|
use MooseX::MethodAttributes::Role::Meta::Role (); |
|
21
|
|
|
|
|
74
|
|
|
21
|
|
|
|
|
801
|
|
12
|
21
|
|
|
21
|
|
886
|
use namespace::autoclean; |
|
21
|
|
|
|
|
7828
|
|
|
21
|
|
|
|
|
117
|
|
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
|
53
|
|
|
53
|
0
|
21904
|
my ($class, %options) = @_; |
44
|
|
|
|
|
|
|
|
45
|
53
|
|
|
|
|
120
|
my $for_class = $options{for_class}; |
46
|
53
|
|
|
|
|
190
|
my $meta = find_meta($for_class); |
47
|
|
|
|
|
|
|
|
48
|
53
|
50
|
100
|
|
|
738
|
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
|
23
|
100
|
|
|
|
2807
|
$meta = Moose::Meta::Class->create( $for_class ) |
54
|
|
|
|
|
|
|
unless $meta; |
55
|
|
|
|
|
|
|
|
56
|
23
|
|
|
|
|
11619
|
$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
|
23
|
|
|
|
|
96690
|
Moose::Util::MetaRole::apply_base_class_roles( |
67
|
|
|
|
|
|
|
for_class => $for_class, |
68
|
|
|
|
|
|
|
roles => ['MooseX::MethodAttributes::Role::AttrContainer'], |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
23
|
|
|
|
|
51298
|
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.30 |
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 AUTHORS |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over 4 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Tomas Doran <bobtfish@bobtfish.net> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Dave Rolsky Marcus Ramberg Peter E Karman David Steinbrunner |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=over 4 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Marcus Ramberg <marcus@nordaaker.com> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Peter E Karman <pek@dewpoint.msi.umn.edu> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
David Steinbrunner <dsteinbrunner@pobox.com> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This software is copyright (c) 2009 by Florian Ragwitz. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
155
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |