| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MooseX::MethodAttributes::Role; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: code attribute introspection |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.31'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
21
|
|
|
21
|
|
1445
|
use Moose (); |
|
|
21
|
|
|
|
|
439391
|
|
|
|
21
|
|
|
|
|
436
|
|
|
7
|
21
|
|
|
21
|
|
102
|
use Moose::Exporter; |
|
|
21
|
|
|
|
|
35
|
|
|
|
21
|
|
|
|
|
134
|
|
|
8
|
21
|
|
|
21
|
|
672
|
use Moose::Util::MetaRole; |
|
|
21
|
|
|
|
|
35
|
|
|
|
21
|
|
|
|
|
556
|
|
|
9
|
21
|
|
|
21
|
|
96
|
use Moose::Util qw/find_meta does_role ensure_all_roles/; |
|
|
21
|
|
|
|
|
34
|
|
|
|
21
|
|
|
|
|
119
|
|
|
10
|
|
|
|
|
|
|
# Ensure trait is registered |
|
11
|
21
|
|
|
21
|
|
8413
|
use MooseX::MethodAttributes::Role::Meta::Role (); |
|
|
21
|
|
|
|
|
38
|
|
|
|
21
|
|
|
|
|
418
|
|
|
12
|
21
|
|
|
21
|
|
9614
|
use namespace::autoclean; |
|
|
21
|
|
|
|
|
111717
|
|
|
|
21
|
|
|
|
|
106
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
15
|
|
|
|
|
|
|
#pod |
|
16
|
|
|
|
|
|
|
#pod package MyRole; |
|
17
|
|
|
|
|
|
|
#pod use MooseX::MethodAttributes::Role; |
|
18
|
|
|
|
|
|
|
#pod |
|
19
|
|
|
|
|
|
|
#pod sub foo : Bar Baz('corge') { ... } |
|
20
|
|
|
|
|
|
|
#pod |
|
21
|
|
|
|
|
|
|
#pod my $attrs = MyRole->meta->get_method('foo')->attributes; # ["Bar", "Baz('corge')"] |
|
22
|
|
|
|
|
|
|
#pod |
|
23
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
24
|
|
|
|
|
|
|
#pod |
|
25
|
|
|
|
|
|
|
#pod This module allows you to write a Moose Role with code attributes of methods to |
|
26
|
|
|
|
|
|
|
#pod be introspected using Moose meta method objects. |
|
27
|
|
|
|
|
|
|
#pod |
|
28
|
|
|
|
|
|
|
#pod =begin Pod::Coverage |
|
29
|
|
|
|
|
|
|
#pod |
|
30
|
|
|
|
|
|
|
#pod init_meta |
|
31
|
|
|
|
|
|
|
#pod |
|
32
|
|
|
|
|
|
|
#pod =end Pod::Coverage |
|
33
|
|
|
|
|
|
|
#pod |
|
34
|
|
|
|
|
|
|
#pod =cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( also => 'Moose::Role' ); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub init_meta { |
|
39
|
10
|
|
|
10
|
0
|
21970
|
my ($class, %options) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
10
|
|
|
|
|
24
|
my $for_class = $options{for_class}; |
|
42
|
10
|
|
|
|
|
105
|
my $meta = find_meta($for_class); |
|
43
|
|
|
|
|
|
|
|
|
44
|
10
|
100
|
100
|
|
|
125
|
return $meta if $meta |
|
45
|
|
|
|
|
|
|
&& does_role($meta, 'MooseX::MethodAttributes::Role::Meta::Role'); |
|
46
|
|
|
|
|
|
|
|
|
47
|
9
|
100
|
|
|
|
207
|
$meta = Moose::Meta::Role->create( $for_class ) |
|
48
|
|
|
|
|
|
|
unless $meta; |
|
49
|
|
|
|
|
|
|
|
|
50
|
9
|
|
|
|
|
7731
|
$meta = Moose::Util::MetaRole::apply_metaroles( |
|
51
|
|
|
|
|
|
|
for => $meta->name, |
|
52
|
|
|
|
|
|
|
role_metaroles => { |
|
53
|
|
|
|
|
|
|
role => ['MooseX::MethodAttributes::Role::Meta::Role'], |
|
54
|
|
|
|
|
|
|
}, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
9
|
|
|
|
|
5781
|
ensure_all_roles($meta->name, |
|
58
|
|
|
|
|
|
|
'MooseX::MethodAttributes::Role::AttrContainer', |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
9
|
|
|
|
|
2187
|
return $meta; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=encoding UTF-8 |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
MooseX::MethodAttributes::Role - code attribute introspection |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 VERSION |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
version 0.31 |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
package MyRole; |
|
83
|
|
|
|
|
|
|
use MooseX::MethodAttributes::Role; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub foo : Bar Baz('corge') { ... } |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $attrs = MyRole->meta->get_method('foo')->attributes; # ["Bar", "Baz('corge')"] |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This module allows you to write a Moose Role with code attributes of methods to |
|
92
|
|
|
|
|
|
|
be introspected using Moose meta method objects. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=for Pod::Coverage init_meta |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SUPPORT |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-MethodAttributes> |
|
99
|
|
|
|
|
|
|
(or L<bug-MooseX-MethodAttributes@rt.cpan.org|mailto:bug-MooseX-MethodAttributes@rt.cpan.org>). |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
|
102
|
|
|
|
|
|
|
L<http://lists.perl.org/list/moose.html>. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
|
105
|
|
|
|
|
|
|
irc://irc.perl.org/#moose. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHORS |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=over 4 |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Tomas Doran <bobtfish@bobtfish.net> |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This software is copyright (c) 2009 by Florian Ragwitz. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
126
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |