Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/Role.pm |
Statements | Executed 276 statements in 3.91ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 733µs | 3.28ms | BEGIN@11 | Moose::Meta::Role::
1 | 1 | 1 | 365µs | 1.50ms | BEGIN@14 | Moose::Meta::Role::
1 | 1 | 1 | 309µs | 1.52ms | BEGIN@13 | Moose::Meta::Role::
1 | 1 | 1 | 232µs | 311µs | BEGIN@12 | Moose::Meta::Role::
13 | 1 | 1 | 145µs | 968µs | add_attribute | Moose::Meta::Role::
4 | 1 | 1 | 109µs | 41.1ms | apply | Moose::Meta::Role::
16 | 2 | 1 | 89µs | 134µs | get_method_modifier_list | Moose::Meta::Role::
3 | 1 | 1 | 72µs | 523µs | initialize | Moose::Meta::Role::
13 | 1 | 1 | 42µs | 161µs | _attach_attribute | Moose::Meta::Role::
1 | 1 | 1 | 17µs | 524µs | BEGIN@6 | Moose::Meta::Role::
9 | 3 | 1 | 15µs | 15µs | __ANON__[:305] | Moose::Meta::Role::
1 | 1 | 1 | 15µs | 30µs | BEGIN@4 | Moose::Meta::Role::
1 | 1 | 1 | 12µs | 181µs | BEGIN@16 | Moose::Meta::Role::
3 | 1 | 1 | 12µs | 66µs | find_method_by_name | Moose::Meta::Role::
6 | 2 | 1 | 10µs | 10µs | __ANON__[:84] | Moose::Meta::Role::
1 | 1 | 1 | 9µs | 17µs | BEGIN@5 | Moose::Meta::Role::
1 | 1 | 1 | 9µs | 45µs | BEGIN@8 | Moose::Meta::Role::
1 | 1 | 1 | 8µs | 58µs | BEGIN@19 | Moose::Meta::Role::
1 | 1 | 1 | 8µs | 8µs | BEGIN@15 | Moose::Meta::Role::
1 | 1 | 1 | 7µs | 7µs | BEGIN@17 | Moose::Meta::Role::
1 | 1 | 1 | 6µs | 6µs | BEGIN@10 | Moose::Meta::Role::
3 | 1 | 1 | 6µs | 6µs | __ANON__[:351] | Moose::Meta::Role::
3 | 1 | 1 | 5µs | 5µs | __ANON__[:398] | Moose::Meta::Role::
3 | 1 | 1 | 5µs | 5µs | _meta_method_class | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:102] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:107] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:112] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:117] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:315] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:323] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:342] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:591] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:92] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | __ANON__[:97] | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | _anon_cache_key | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | _anon_package_prefix | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | _restore_metaobjects_from | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | _role_for_combination | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | add_conflicting_method | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | add_override_method_modifier | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | add_required_methods | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | add_role | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | calculate_all_roles | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | combine | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | composition_class_roles | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | consumers | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | create | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | create_anon_role | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | does_role | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | get_override_method_modifier | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | has_override_method_modifier | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | is_anon_role | Moose::Meta::Role::
0 | 0 | 0 | 0s | 0s | reinitialize | Moose::Meta::Role::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Moose::Meta::Role; | ||||
2 | 1 | 800ns | our $VERSION = '2.1403'; | ||
3 | |||||
4 | 2 | 30µs | 2 | 45µs | # spent 30µs (15+15) within Moose::Meta::Role::BEGIN@4 which was called:
# once (15µs+15µs) by Moose::BEGIN@32 at line 4 # spent 30µs making 1 call to Moose::Meta::Role::BEGIN@4
# spent 15µs making 1 call to strict::import |
5 | 2 | 23µs | 2 | 24µs | # spent 17µs (9+8) within Moose::Meta::Role::BEGIN@5 which was called:
# once (9µs+8µs) by Moose::BEGIN@32 at line 5 # spent 17µs making 1 call to Moose::Meta::Role::BEGIN@5
# spent 8µs making 1 call to warnings::import |
6 | 2 | 29µs | 2 | 1.03ms | # spent 524µs (17+506) within Moose::Meta::Role::BEGIN@6 which was called:
# once (17µs+506µs) by Moose::BEGIN@32 at line 6 # spent 524µs making 1 call to Moose::Meta::Role::BEGIN@6
# spent 506µs making 1 call to metaclass::import |
7 | |||||
8 | 2 | 25µs | 2 | 81µs | # spent 45µs (9+36) within Moose::Meta::Role::BEGIN@8 which was called:
# once (9µs+36µs) by Moose::BEGIN@32 at line 8 # spent 45µs making 1 call to Moose::Meta::Role::BEGIN@8
# spent 36µs making 1 call to Exporter::import |
9 | |||||
10 | 2 | 25µs | 1 | 6µs | # spent 6µs within Moose::Meta::Role::BEGIN@10 which was called:
# once (6µs+0s) by Moose::BEGIN@32 at line 10 # spent 6µs making 1 call to Moose::Meta::Role::BEGIN@10 |
11 | 2 | 124µs | 1 | 3.28ms | # spent 3.28ms (733µs+2.55) within Moose::Meta::Role::BEGIN@11 which was called:
# once (733µs+2.55ms) by Moose::BEGIN@32 at line 11 # spent 3.28ms making 1 call to Moose::Meta::Role::BEGIN@11 |
12 | 2 | 125µs | 1 | 311µs | # spent 311µs (232+79) within Moose::Meta::Role::BEGIN@12 which was called:
# once (232µs+79µs) by Moose::BEGIN@32 at line 12 # spent 311µs making 1 call to Moose::Meta::Role::BEGIN@12 |
13 | 2 | 117µs | 1 | 1.52ms | # spent 1.52ms (309µs+1.21) within Moose::Meta::Role::BEGIN@13 which was called:
# once (309µs+1.21ms) by Moose::BEGIN@32 at line 13 # spent 1.52ms making 1 call to Moose::Meta::Role::BEGIN@13 |
14 | 2 | 163µs | 1 | 1.50ms | # spent 1.50ms (365µs+1.13) within Moose::Meta::Role::BEGIN@14 which was called:
# once (365µs+1.13ms) by Moose::BEGIN@32 at line 14 # spent 1.50ms making 1 call to Moose::Meta::Role::BEGIN@14 |
15 | 2 | 26µs | 1 | 8µs | # spent 8µs within Moose::Meta::Role::BEGIN@15 which was called:
# once (8µs+0s) by Moose::BEGIN@32 at line 15 # spent 8µs making 1 call to Moose::Meta::Role::BEGIN@15 |
16 | 2 | 27µs | 2 | 349µs | # spent 181µs (12+168) within Moose::Meta::Role::BEGIN@16 which was called:
# once (12µs+168µs) by Moose::BEGIN@32 at line 16 # spent 181µs making 1 call to Moose::Meta::Role::BEGIN@16
# spent 168µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
17 | 2 | 29µs | 1 | 7µs | # spent 7µs within Moose::Meta::Role::BEGIN@17 which was called:
# once (7µs+0s) by Moose::BEGIN@32 at line 17 # spent 7µs making 1 call to Moose::Meta::Role::BEGIN@17 |
18 | |||||
19 | 2 | 6µs | # spent 58µs (8+49) within Moose::Meta::Role::BEGIN@19 which was called:
# once (8µs+49µs) by Moose::BEGIN@32 at line 22 | ||
20 | 'Class::MOP::Mixin::HasAttributes', | ||||
21 | 'Class::MOP::Mixin::HasMethods', | ||||
22 | 1 | 2.35ms | 2 | 107µs | 'Class::MOP::Mixin::HasOverloads'; # spent 58µs making 1 call to Moose::Meta::Role::BEGIN@19
# spent 49µs making 1 call to parent::import |
23 | |||||
24 | 1 | 3µs | 1 | 1.46ms | Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); # spent 1.46ms making 1 call to Class::MOP::MiniTrait::apply |
25 | |||||
26 | ## ------------------------------------------------------------------ | ||||
27 | ## NOTE: | ||||
28 | ## I normally don't do this, but I am doing | ||||
29 | ## a whole bunch of meta-programmin' in this | ||||
30 | ## module, so it just makes sense. For a clearer | ||||
31 | ## picture of what is going on in the next | ||||
32 | ## several lines of code, look at the really | ||||
33 | ## big comment at the end of this file (right | ||||
34 | ## before the POD). | ||||
35 | ## - SL | ||||
36 | ## ------------------------------------------------------------------ | ||||
37 | |||||
38 | 1 | 4µs | 1 | 21µs | my $META = __PACKAGE__->meta; # spent 21µs making 1 call to Moose::Meta::Role::meta |
39 | |||||
40 | ## ------------------------------------------------------------------ | ||||
41 | ## attributes ... | ||||
42 | |||||
43 | # NOTE: | ||||
44 | # since roles are lazy, we hold all the attributes | ||||
45 | # of the individual role in 'stasis' until which | ||||
46 | # time when it is applied to a class. This means | ||||
47 | # keeping a lot of things in hash maps, so we are | ||||
48 | # using a little of that meta-programmin' magic | ||||
49 | # here and saving lots of extra typin'. And since | ||||
50 | # many of these attributes above require similar | ||||
51 | # functionality to support them, so we again use | ||||
52 | # the wonders of meta-programmin' to deliver a | ||||
53 | # very compact solution to this normally verbose | ||||
54 | # problem. | ||||
55 | # - SL | ||||
56 | |||||
57 | 1 | 11µs | foreach my $action ( | ||
58 | { | ||||
59 | name => 'excluded_roles_map', | ||||
60 | attr_reader => 'get_excluded_roles_map' , | ||||
61 | methods => { | ||||
62 | add => 'add_excluded_roles', | ||||
63 | get_keys => 'get_excluded_roles_list', | ||||
64 | existence => 'excludes_role', | ||||
65 | } | ||||
66 | }, | ||||
67 | { | ||||
68 | name => 'required_methods', | ||||
69 | attr_reader => 'get_required_methods_map', | ||||
70 | methods => { | ||||
71 | remove => 'remove_required_methods', | ||||
72 | get_values => 'get_required_method_list', | ||||
73 | existence => 'requires_method', | ||||
74 | } | ||||
75 | }, | ||||
76 | ) { | ||||
77 | |||||
78 | 18 | 41µs | my $attr_reader = $action->{attr_reader}; | ||
79 | my $methods = $action->{methods}; | ||||
80 | |||||
81 | # create the attribute | ||||
82 | $META->add_attribute($action->{name} => ( | ||||
83 | reader => $attr_reader, | ||||
84 | 6 | 14µs | # spent 10µs within Moose::Meta::Role::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/Role.pm:84] which was called 6 times, avg 2µs/call:
# 3 times (6µs+0s) by Moose::Meta::Role::_new at line 90 of (eval 25)[Eval/Closure.pm:125], avg 2µs/call
# 3 times (4µs+0s) by Moose::Meta::Role::_new at line 120 of (eval 25)[Eval/Closure.pm:125], avg 1µs/call | ||
85 | 4 | 970µs | Class::MOP::_definition_context(), # spent 953µs making 2 calls to Class::MOP::Mixin::HasAttributes::add_attribute, avg 476µs/call
# spent 18µs making 2 calls to Class::MOP::_definition_context, avg 9µs/call | ||
86 | )); | ||||
87 | |||||
88 | # create some helper methods | ||||
89 | $META->add_method($methods->{add} => sub { | ||||
90 | my ($self, @values) = @_; | ||||
91 | $self->$attr_reader->{$_} = undef foreach @values; | ||||
92 | 1 | 62µs | }) if exists $methods->{add}; # spent 62µs making 1 call to Class::MOP::Mixin::HasMethods::add_method | ||
93 | |||||
94 | $META->add_method($methods->{get_keys} => sub { | ||||
95 | 8 | 28µs | my ($self) = @_; | ||
96 | 4 | 12µs | keys %{$self->$attr_reader}; # spent 12µs making 4 calls to Moose::Meta::Role::get_excluded_roles_map, avg 3µs/call | ||
97 | 1 | 59µs | }) if exists $methods->{get_keys}; # spent 59µs making 1 call to Class::MOP::Mixin::HasMethods::add_method | ||
98 | |||||
99 | $META->add_method($methods->{get_values} => sub { | ||||
100 | 8 | 21µs | my ($self) = @_; | ||
101 | 4 | 10µs | values %{$self->$attr_reader}; # spent 10µs making 4 calls to Moose::Meta::Role::get_required_methods_map, avg 2µs/call | ||
102 | 1 | 61µs | }) if exists $methods->{get_values}; # spent 61µs making 1 call to Class::MOP::Mixin::HasMethods::add_method | ||
103 | |||||
104 | $META->add_method($methods->{get} => sub { | ||||
105 | my ($self, $name) = @_; | ||||
106 | $self->$attr_reader->{$name} | ||||
107 | }) if exists $methods->{get}; | ||||
108 | |||||
109 | $META->add_method($methods->{existence} => sub { | ||||
110 | my ($self, $name) = @_; | ||||
111 | exists $self->$attr_reader->{$name} ? 1 : 0; | ||||
112 | 2 | 114µs | }) if exists $methods->{existence}; # spent 114µs making 2 calls to Class::MOP::Mixin::HasMethods::add_method, avg 57µs/call | ||
113 | |||||
114 | $META->add_method($methods->{remove} => sub { | ||||
115 | my ($self, @values) = @_; | ||||
116 | delete $self->$attr_reader->{$_} foreach @values; | ||||
117 | 1 | 57µs | }) if exists $methods->{remove}; # spent 57µs making 1 call to Class::MOP::Mixin::HasMethods::add_method | ||
118 | } | ||||
119 | |||||
120 | $META->add_attribute( | ||||
121 | 1 | 3µs | 2 | 429µs | 'method_metaclass', # spent 421µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 7µs making 1 call to Class::MOP::_definition_context |
122 | reader => 'method_metaclass', | ||||
123 | default => 'Moose::Meta::Role::Method', | ||||
124 | Class::MOP::_definition_context(), | ||||
125 | ); | ||||
126 | |||||
127 | 1 | 3µs | 2 | 429µs | $META->add_attribute( # spent 422µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 7µs making 1 call to Class::MOP::_definition_context |
128 | 'required_method_metaclass', | ||||
129 | reader => 'required_method_metaclass', | ||||
130 | default => 'Moose::Meta::Role::Method::Required', | ||||
131 | Class::MOP::_definition_context(), | ||||
132 | ); | ||||
133 | |||||
134 | 1 | 3µs | 2 | 425µs | $META->add_attribute( # spent 418µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 7µs making 1 call to Class::MOP::_definition_context |
135 | 'conflicting_method_metaclass', | ||||
136 | reader => 'conflicting_method_metaclass', | ||||
137 | default => 'Moose::Meta::Role::Method::Conflicting', | ||||
138 | Class::MOP::_definition_context(), | ||||
139 | ); | ||||
140 | |||||
141 | 1 | 3µs | 2 | 418µs | $META->add_attribute( # spent 411µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 7µs making 1 call to Class::MOP::_definition_context |
142 | 'application_to_class_class', | ||||
143 | reader => 'application_to_class_class', | ||||
144 | default => 'Moose::Meta::Role::Application::ToClass', | ||||
145 | Class::MOP::_definition_context(), | ||||
146 | ); | ||||
147 | |||||
148 | 1 | 3µs | 2 | 413µs | $META->add_attribute( # spent 406µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 7µs making 1 call to Class::MOP::_definition_context |
149 | 'application_to_role_class', | ||||
150 | reader => 'application_to_role_class', | ||||
151 | default => 'Moose::Meta::Role::Application::ToRole', | ||||
152 | Class::MOP::_definition_context(), | ||||
153 | ); | ||||
154 | |||||
155 | 1 | 3µs | 2 | 369µs | $META->add_attribute( # spent 363µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 6µs making 1 call to Class::MOP::_definition_context |
156 | 'application_to_instance_class', | ||||
157 | reader => 'application_to_instance_class', | ||||
158 | default => 'Moose::Meta::Role::Application::ToInstance', | ||||
159 | Class::MOP::_definition_context(), | ||||
160 | ); | ||||
161 | |||||
162 | 1 | 3µs | 2 | 448µs | $META->add_attribute( # spent 442µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 6µs making 1 call to Class::MOP::_definition_context |
163 | 'applied_attribute_metaclass', | ||||
164 | reader => 'applied_attribute_metaclass', | ||||
165 | default => 'Moose::Meta::Attribute', | ||||
166 | Class::MOP::_definition_context(), | ||||
167 | ); | ||||
168 | |||||
169 | # More or less copied from Moose::Meta::Class | ||||
170 | # spent 523µs (72+451) within Moose::Meta::Role::initialize which was called 3 times, avg 174µs/call:
# 3 times (72µs+451µs) by Moose::Role::init_meta at line 143 of Moose/Role.pm, avg 174µs/call | ||||
171 | 18 | 63µs | my $class = shift; | ||
172 | my @args = @_; | ||||
173 | unshift @args, 'package' if @args % 2; | ||||
174 | my %opts = @args; | ||||
175 | my $package = delete $opts{package}; | ||||
176 | 6 | 451µs | return Class::MOP::get_metaclass_by_name($package) # spent 448µs making 3 calls to Class::MOP::Package::initialize, avg 149µs/call
# spent 3µs making 3 calls to Class::MOP::get_metaclass_by_name, avg 933ns/call | ||
177 | || $class->SUPER::initialize($package, | ||||
178 | 'attribute_metaclass' => 'Moose::Meta::Role::Attribute', | ||||
179 | %opts, | ||||
180 | ); | ||||
181 | } | ||||
182 | |||||
183 | sub reinitialize { | ||||
184 | my $self = shift; | ||||
185 | my $pkg = shift; | ||||
186 | |||||
187 | my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg); | ||||
188 | |||||
189 | my %existing_classes; | ||||
190 | if ($meta) { | ||||
191 | %existing_classes = map { $_ => $meta->$_() } qw( | ||||
192 | attribute_metaclass | ||||
193 | method_metaclass | ||||
194 | wrapped_method_metaclass | ||||
195 | required_method_metaclass | ||||
196 | conflicting_method_metaclass | ||||
197 | application_to_class_class | ||||
198 | application_to_role_class | ||||
199 | application_to_instance_class | ||||
200 | applied_attribute_metaclass | ||||
201 | ); | ||||
202 | } | ||||
203 | |||||
204 | my %options = @_; | ||||
205 | $options{weaken} = Class::MOP::metaclass_is_weak($meta->name) | ||||
206 | if !exists $options{weaken} | ||||
207 | && blessed($meta) | ||||
208 | && $meta->isa('Moose::Meta::Role'); | ||||
209 | |||||
210 | # don't need to remove generated metaobjects here yet, since we don't | ||||
211 | # yet generate anything in roles. this may change in the future though... | ||||
212 | # keep an eye on that | ||||
213 | my $new_meta = $self->SUPER::reinitialize( | ||||
214 | $pkg, | ||||
215 | %existing_classes, | ||||
216 | %options, | ||||
217 | ); | ||||
218 | $new_meta->_restore_metaobjects_from($meta) | ||||
219 | if $meta && $meta->isa('Moose::Meta::Role'); | ||||
220 | return $new_meta; | ||||
221 | } | ||||
222 | |||||
223 | sub _restore_metaobjects_from { | ||||
224 | my $self = shift; | ||||
225 | my ($old_meta) = @_; | ||||
226 | |||||
227 | $self->_restore_metamethods_from($old_meta); | ||||
228 | $self->_restore_metaattributes_from($old_meta); | ||||
229 | |||||
230 | for my $role ( @{ $old_meta->get_roles } ) { | ||||
231 | $self->add_role($role); | ||||
232 | } | ||||
233 | } | ||||
234 | |||||
235 | # spent 968µs (145+823) within Moose::Meta::Role::add_attribute which was called 13 times, avg 74µs/call:
# 13 times (145µs+823µs) by Moose::Role::has at line 52 of Moose/Role.pm, avg 74µs/call | ||||
236 | 39 | 152µs | my $self = shift; | ||
237 | |||||
238 | 39 | 18µs | if (blessed $_[0] && ! $_[0]->isa('Moose::Meta::Role::Attribute') ) { # spent 11µs making 26 calls to Scalar::Util::blessed, avg 438ns/call
# spent 7µs making 13 calls to Moose::Meta::Role::CORE:match, avg 508ns/call | ||
239 | my $class = ref $_[0]; | ||||
240 | throw_exception( CannotAddAsAnAttributeToARole => role_name => $self->name, | ||||
241 | attribute_class => $class, | ||||
242 | ); | ||||
243 | } | ||||
244 | elsif (!blessed($_[0]) && defined($_[0]) && $_[0] =~ /^\+(.*)/) { | ||||
245 | throw_exception( AttributeExtensionIsNotSupportedInRoles => attribute_name => $_[0], | ||||
246 | role_name => $self->name, | ||||
247 | ); | ||||
248 | } | ||||
249 | |||||
250 | 13 | 805µs | return $self->SUPER::add_attribute(@_); # spent 805µs making 13 calls to Class::MOP::Mixin::HasAttributes::add_attribute, avg 62µs/call | ||
251 | } | ||||
252 | |||||
253 | # spent 161µs (42+119) within Moose::Meta::Role::_attach_attribute which was called 13 times, avg 12µs/call:
# 13 times (42µs+119µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 22 of Class/MOP/Mixin/HasAttributes.pm, avg 12µs/call | ||||
254 | 26 | 38µs | my ( $self, $attribute ) = @_; | ||
255 | |||||
256 | 13 | 119µs | $attribute->attach_to_role($self); # spent 119µs making 13 calls to Moose::Meta::Role::Attribute::attach_to_role, avg 9µs/call | ||
257 | } | ||||
258 | |||||
259 | sub add_required_methods { | ||||
260 | my $self = shift; | ||||
261 | |||||
262 | for (@_) { | ||||
263 | my $method = $_; | ||||
264 | if (!blessed($method)) { | ||||
265 | $method = $self->required_method_metaclass->new( | ||||
266 | name => $method, | ||||
267 | ); | ||||
268 | } | ||||
269 | $self->get_required_methods_map->{$method->name} = $method; | ||||
270 | } | ||||
271 | } | ||||
272 | |||||
273 | sub add_conflicting_method { | ||||
274 | my $self = shift; | ||||
275 | |||||
276 | my $method; | ||||
277 | if (@_ == 1 && blessed($_[0])) { | ||||
278 | $method = shift; | ||||
279 | } | ||||
280 | else { | ||||
281 | $method = $self->conflicting_method_metaclass->new(@_); | ||||
282 | } | ||||
283 | |||||
284 | $self->add_required_methods($method); | ||||
285 | } | ||||
286 | |||||
287 | ## ------------------------------------------------------------------ | ||||
288 | ## method modifiers | ||||
289 | |||||
290 | # NOTE: | ||||
291 | # the before/around/after method modifiers are | ||||
292 | # stored by name, but there can be many methods | ||||
293 | # then associated with that name. So again we have | ||||
294 | # lots of similar functionality, so we can do some | ||||
295 | # meta-programmin' and save some time. | ||||
296 | # - SL | ||||
297 | |||||
298 | 1 | 1µs | foreach my $modifier_type (qw[ before around after ]) { | ||
299 | |||||
300 | 15 | 61µs | my $attr_reader = "get_${modifier_type}_method_modifiers_map"; | ||
301 | |||||
302 | # create the attribute ... | ||||
303 | $META->add_attribute("${modifier_type}_method_modifiers" => ( | ||||
304 | reader => $attr_reader, | ||||
305 | 9 | 25µs | # spent 15µs within Moose::Meta::Role::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/Role.pm:305] which was called 9 times, avg 2µs/call:
# 3 times (7µs+0s) by Moose::Meta::Role::_new at line 27 of (eval 25)[Eval/Closure.pm:125], avg 2µs/call
# 3 times (5µs+0s) by Moose::Meta::Role::_new at line 78 of (eval 25)[Eval/Closure.pm:125], avg 2µs/call
# 3 times (4µs+0s) by Moose::Meta::Role::_new at line 57 of (eval 25)[Eval/Closure.pm:125], avg 1µs/call | ||
306 | 6 | 1.22ms | Class::MOP::_definition_context(), # spent 1.20ms making 3 calls to Class::MOP::Mixin::HasAttributes::add_attribute, avg 399µs/call
# spent 19µs making 3 calls to Class::MOP::_definition_context, avg 6µs/call | ||
307 | )); | ||||
308 | |||||
309 | # and some helper methods ... | ||||
310 | $META->add_method("get_${modifier_type}_method_modifiers" => sub { | ||||
311 | my ($self, $method_name) = @_; | ||||
312 | #return () unless exists $self->$attr_reader->{$method_name}; | ||||
313 | my $mm = $self->$attr_reader->{$method_name}; | ||||
314 | $mm ? @$mm : (); | ||||
315 | 3 | 170µs | }); # spent 170µs making 3 calls to Class::MOP::Mixin::HasMethods::add_method, avg 57µs/call | ||
316 | |||||
317 | $META->add_method("has_${modifier_type}_method_modifiers" => sub { | ||||
318 | my ($self, $method_name) = @_; | ||||
319 | # NOTE: | ||||
320 | # for now we assume that if it exists,.. | ||||
321 | # it has at least one modifier in it | ||||
322 | (exists $self->$attr_reader->{$method_name}) ? 1 : 0; | ||||
323 | 3 | 152µs | }); # spent 152µs making 3 calls to Class::MOP::Mixin::HasMethods::add_method, avg 51µs/call | ||
324 | |||||
325 | $META->add_method("add_${modifier_type}_method_modifier" => sub { | ||||
326 | my ($self, $method_name, $method) = @_; | ||||
327 | |||||
328 | $self->$attr_reader->{$method_name} = [] | ||||
329 | unless exists $self->$attr_reader->{$method_name}; | ||||
330 | |||||
331 | my $modifiers = $self->$attr_reader->{$method_name}; | ||||
332 | |||||
333 | # NOTE: | ||||
334 | # check to see that we aren't adding the | ||||
335 | # same code twice. We err in favor of the | ||||
336 | # first on here, this may not be as expected | ||||
337 | foreach my $modifier (@{$modifiers}) { | ||||
338 | return if $modifier == $method; | ||||
339 | } | ||||
340 | |||||
341 | push @{$modifiers} => $method; | ||||
342 | 3 | 156µs | }); # spent 156µs making 3 calls to Class::MOP::Mixin::HasMethods::add_method, avg 52µs/call | ||
343 | |||||
344 | } | ||||
345 | |||||
346 | ## ------------------------------------------------------------------ | ||||
347 | ## override method modifiers | ||||
348 | |||||
349 | $META->add_attribute('override_method_modifiers' => ( | ||||
350 | reader => 'get_override_method_modifiers_map', | ||||
351 | 3 | 7µs | # spent 6µs within Moose::Meta::Role::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/Role.pm:351] which was called 3 times, avg 2µs/call:
# 3 times (6µs+0s) by Moose::Meta::Role::_new at line 105 of (eval 25)[Eval/Closure.pm:125], avg 2µs/call | ||
352 | 1 | 4µs | 2 | 378µs | Class::MOP::_definition_context(), # spent 372µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 6µs making 1 call to Class::MOP::_definition_context |
353 | )); | ||||
354 | |||||
355 | # NOTE: | ||||
356 | # these are a little different because there | ||||
357 | # can only be one per name, whereas the other | ||||
358 | # method modifiers can have multiples. | ||||
359 | # - SL | ||||
360 | |||||
361 | sub add_override_method_modifier { | ||||
362 | my ($self, $method_name, $method) = @_; | ||||
363 | (!$self->has_method($method_name)) | ||||
364 | || throw_exception( CannotOverrideALocalMethod => method_name => $method_name, | ||||
365 | role_name => $self->name, | ||||
366 | ); | ||||
367 | $self->get_override_method_modifiers_map->{$method_name} = $method; | ||||
368 | } | ||||
369 | |||||
370 | sub has_override_method_modifier { | ||||
371 | my ($self, $method_name) = @_; | ||||
372 | # NOTE: | ||||
373 | # for now we assume that if it exists,.. | ||||
374 | # it has at least one modifier in it | ||||
375 | (exists $self->get_override_method_modifiers_map->{$method_name}) ? 1 : 0; | ||||
376 | } | ||||
377 | |||||
378 | sub get_override_method_modifier { | ||||
379 | my ($self, $method_name) = @_; | ||||
380 | $self->get_override_method_modifiers_map->{$method_name}; | ||||
381 | } | ||||
382 | |||||
383 | ## general list accessor ... | ||||
384 | |||||
385 | # spent 134µs (89+45) within Moose::Meta::Role::get_method_modifier_list which was called 16 times, avg 8µs/call:
# 12 times (60µs+33µs) by Moose::Meta::Role::Application::ToClass::apply_method_modifiers at line 203 of Moose/Meta/Role/Application/ToClass.pm, avg 8µs/call
# 4 times (29µs+12µs) by Moose::Meta::Role::Application::ToClass::apply_override_method_modifiers at line 181 of Moose/Meta/Role/Application/ToClass.pm, avg 10µs/call | ||||
386 | 48 | 85µs | my ($self, $modifier_type) = @_; | ||
387 | my $accessor = "get_${modifier_type}_method_modifiers_map"; | ||||
388 | 16 | 45µs | keys %{$self->$accessor}; # spent 12µs making 4 calls to Moose::Meta::Role::get_after_method_modifiers_map, avg 3µs/call
# spent 12µs making 4 calls to Moose::Meta::Role::get_override_method_modifiers_map, avg 3µs/call
# spent 11µs making 4 calls to Moose::Meta::Role::get_around_method_modifiers_map, avg 3µs/call
# spent 11µs making 4 calls to Moose::Meta::Role::get_before_method_modifiers_map, avg 3µs/call | ||
389 | } | ||||
390 | |||||
391 | 3 | 13µs | # spent 5µs within Moose::Meta::Role::_meta_method_class which was called 3 times, avg 2µs/call:
# 3 times (5µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 24 of Class/MOP/Mixin/HasMethods.pm, avg 2µs/call | ||
392 | |||||
393 | ## ------------------------------------------------------------------ | ||||
394 | ## subroles | ||||
395 | |||||
396 | $META->add_attribute('roles' => ( | ||||
397 | reader => 'get_roles', | ||||
398 | 3 | 8µs | # spent 5µs within Moose::Meta::Role::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/Role.pm:398] which was called 3 times, avg 2µs/call:
# 3 times (5µs+0s) by Moose::Meta::Role::_new at line 126 of (eval 25)[Eval/Closure.pm:125], avg 2µs/call | ||
399 | 1 | 5µs | 2 | 370µs | Class::MOP::_definition_context(), # spent 363µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 6µs making 1 call to Class::MOP::_definition_context |
400 | )); | ||||
401 | |||||
402 | sub add_role { | ||||
403 | my ($self, $role) = @_; | ||||
404 | (blessed($role) && $role->isa('Moose::Meta::Role')) | ||||
405 | || throw_exception( AddRoleToARoleTakesAMooseMetaRole => role_to_be_added => $role, | ||||
406 | role_name => $self->name, | ||||
407 | ); | ||||
408 | push @{$self->get_roles} => $role; | ||||
409 | $self->reset_package_cache_flag; | ||||
410 | } | ||||
411 | |||||
412 | sub calculate_all_roles { | ||||
413 | my $self = shift; | ||||
414 | my %seen; | ||||
415 | grep { | ||||
416 | !$seen{$_->name}++ | ||||
417 | } ($self, map { | ||||
418 | $_->calculate_all_roles | ||||
419 | } @{ $self->get_roles }); | ||||
420 | } | ||||
421 | |||||
422 | sub does_role { | ||||
423 | my ($self, $role) = @_; | ||||
424 | (defined $role) | ||||
425 | || throw_exception( RoleNameRequiredForMooseMetaRole => role_name => $self->name ); | ||||
426 | my $role_name = blessed $role ? $role->name : $role; | ||||
427 | # if we are it,.. then return true | ||||
428 | return 1 if $role_name eq $self->name; | ||||
429 | # otherwise.. check our children | ||||
430 | foreach my $role (@{$self->get_roles}) { | ||||
431 | return 1 if $role->does_role($role_name); | ||||
432 | } | ||||
433 | return 0; | ||||
434 | } | ||||
435 | |||||
436 | 3 | 9µs | 3 | 54µs | # spent 66µs (12+54) within Moose::Meta::Role::find_method_by_name which was called 3 times, avg 22µs/call:
# 3 times (12µs+54µs) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 19 of Class/MOP/Mixin/HasMethods.pm, avg 22µs/call # spent 54µs making 3 calls to Class::MOP::Mixin::HasMethods::get_method, avg 18µs/call |
437 | |||||
438 | ## ------------------------------------------------------------------ | ||||
439 | ## role construction | ||||
440 | ## ------------------------------------------------------------------ | ||||
441 | |||||
442 | # spent 41.1ms (109µs+41.0) within Moose::Meta::Role::apply which was called 4 times, avg 10.3ms/call:
# 4 times (109µs+41.0ms) by Moose::Util::_apply_all_roles at line 172 of Moose/Util.pm, avg 10.3ms/call | ||||
443 | 28 | 113µs | my ($self, $other, %args) = @_; | ||
444 | |||||
445 | 4 | 3µs | (blessed($other)) # spent 3µs making 4 calls to Scalar::Util::blessed, avg 700ns/call | ||
446 | || throw_exception( ApplyTakesABlessedInstance => param => $other, | ||||
447 | role_name => $self->name, | ||||
448 | ); | ||||
449 | |||||
450 | my $application_class; | ||||
451 | 12 | 23µs | if ($other->isa('Moose::Meta::Role')) { # spent 14µs making 4 calls to Moose::Meta::Role::application_to_class_class, avg 4µs/call
# spent 9µs making 8 calls to UNIVERSAL::isa, avg 1µs/call | ||
452 | $application_class = $self->application_to_role_class; | ||||
453 | } | ||||
454 | elsif ($other->isa('Moose::Meta::Class')) { | ||||
455 | $application_class = $self->application_to_class_class; | ||||
456 | } | ||||
457 | else { | ||||
458 | $application_class = $self->application_to_instance_class; | ||||
459 | } | ||||
460 | |||||
461 | 4 | 258µs | Moose::Util::_load_user_class($application_class); # spent 258µs making 4 calls to Moose::Util::_load_user_class, avg 65µs/call | ||
462 | |||||
463 | if ( exists $args{'-excludes'} ) { | ||||
464 | # I wish we had coercion here :) | ||||
465 | $args{'-excludes'} = ( | ||||
466 | ref $args{'-excludes'} eq 'ARRAY' | ||||
467 | ? $args{'-excludes'} | ||||
468 | : [ $args{'-excludes'} ] | ||||
469 | ); | ||||
470 | } | ||||
471 | |||||
472 | 8 | 40.7ms | return $application_class->new(%args)->apply($self, $other, \%args); # spent 40.6ms making 4 calls to Moose::Meta::Role::Application::ToClass::apply, avg 10.1ms/call
# spent 148µs making 4 calls to Moose::Meta::Role::Application::new, avg 37µs/call | ||
473 | } | ||||
474 | |||||
475 | sub composition_class_roles { } | ||||
476 | |||||
477 | sub combine { | ||||
478 | my ($class, @role_specs) = @_; | ||||
479 | |||||
480 | require Moose::Meta::Role::Composite; | ||||
481 | |||||
482 | my (@roles, %role_params); | ||||
483 | while (@role_specs) { | ||||
484 | my ($role, $params) = @{ splice @role_specs, 0, 1 }; | ||||
485 | my $requested_role | ||||
486 | = blessed $role | ||||
487 | ? $role | ||||
488 | : Class::MOP::class_of($role); | ||||
489 | |||||
490 | my $actual_role = $requested_role->_role_for_combination($params); | ||||
491 | push @roles => $actual_role; | ||||
492 | |||||
493 | next unless defined $params; | ||||
494 | $role_params{$actual_role->name} = $params; | ||||
495 | } | ||||
496 | |||||
497 | my $c = Moose::Meta::Role::Composite->new(roles => \@roles); | ||||
498 | return $c->apply_params(\%role_params); | ||||
499 | } | ||||
500 | |||||
501 | sub _role_for_combination { | ||||
502 | my ($self, $params) = @_; | ||||
503 | return $self; | ||||
504 | } | ||||
505 | |||||
506 | sub create { | ||||
507 | my $class = shift; | ||||
508 | my @args = @_; | ||||
509 | |||||
510 | unshift @args, 'package' if @args % 2 == 1; | ||||
511 | my %options = @args; | ||||
512 | |||||
513 | (ref $options{attributes} eq 'HASH') | ||||
514 | || throw_exception( CreateTakesHashRefOfAttributes => params => \%options, | ||||
515 | attribute_class => $class | ||||
516 | ) | ||||
517 | if exists $options{attributes}; | ||||
518 | |||||
519 | (ref $options{methods} eq 'HASH') | ||||
520 | || throw_exception( CreateTakesHashRefOfMethods => params => \%options, | ||||
521 | attribute_class => $class | ||||
522 | ) | ||||
523 | if exists $options{methods}; | ||||
524 | |||||
525 | (ref $options{roles} eq 'ARRAY') | ||||
526 | || throw_exception( CreateTakesArrayRefOfRoles => params => \%options, | ||||
527 | attribute_class => $class | ||||
528 | ) | ||||
529 | if exists $options{roles}; | ||||
530 | |||||
531 | my $package = delete $options{package}; | ||||
532 | my $roles = delete $options{roles}; | ||||
533 | my $attributes = delete $options{attributes}; | ||||
534 | my $methods = delete $options{methods}; | ||||
535 | my $meta_name = exists $options{meta_name} | ||||
536 | ? delete $options{meta_name} | ||||
537 | : 'meta'; | ||||
538 | |||||
539 | my $meta = $class->SUPER::create($package => %options); | ||||
540 | |||||
541 | $meta->_add_meta_method($meta_name) | ||||
542 | if defined $meta_name; | ||||
543 | |||||
544 | if (defined $attributes) { | ||||
545 | foreach my $attribute_name (keys %{$attributes}) { | ||||
546 | my $attr = $attributes->{$attribute_name}; | ||||
547 | $meta->add_attribute( | ||||
548 | $attribute_name => blessed $attr ? $attr : %{$attr} ); | ||||
549 | } | ||||
550 | } | ||||
551 | |||||
552 | if (defined $methods) { | ||||
553 | foreach my $method_name (keys %{$methods}) { | ||||
554 | $meta->add_method($method_name, $methods->{$method_name}); | ||||
555 | } | ||||
556 | } | ||||
557 | |||||
558 | if ($roles) { | ||||
559 | Moose::Util::apply_all_roles($meta, @$roles); | ||||
560 | } | ||||
561 | |||||
562 | return $meta; | ||||
563 | } | ||||
564 | |||||
565 | sub consumers { | ||||
566 | my $self = shift; | ||||
567 | my @consumers; | ||||
568 | for my $meta (Class::MOP::get_all_metaclass_instances) { | ||||
569 | next if $meta->name eq $self->name; | ||||
570 | next unless $meta->isa('Moose::Meta::Class') | ||||
571 | || $meta->isa('Moose::Meta::Role'); | ||||
572 | push @consumers, $meta->name | ||||
573 | if $meta->does_role($self->name); | ||||
574 | } | ||||
575 | return @consumers; | ||||
576 | } | ||||
577 | |||||
578 | # XXX: something more intelligent here? | ||||
579 | sub _anon_package_prefix { 'Moose::Meta::Role::__ANON__::SERIAL::' } | ||||
580 | |||||
581 | sub create_anon_role { shift->create_anon(@_) } | ||||
582 | sub is_anon_role { shift->is_anon(@_) } | ||||
583 | |||||
584 | sub _anon_cache_key { | ||||
585 | my $class = shift; | ||||
586 | my %options = @_; | ||||
587 | |||||
588 | # XXX fix this duplication (see MMC::_anon_cache_key | ||||
589 | my $roles = Data::OptList::mkopt(($options{roles} || []), { | ||||
590 | moniker => 'role', | ||||
591 | val_test => sub { ref($_[0]) eq 'HASH' }, | ||||
592 | }); | ||||
593 | |||||
594 | my @role_keys; | ||||
595 | for my $role_spec (@$roles) { | ||||
596 | my ($role, $params) = @$role_spec; | ||||
597 | $params = { %$params }; | ||||
598 | |||||
599 | my $key = blessed($role) ? $role->name : $role; | ||||
600 | |||||
601 | if ($params && %$params) { | ||||
602 | my $alias = delete $params->{'-alias'} | ||||
603 | || delete $params->{'alias'} | ||||
604 | || {}; | ||||
605 | my $excludes = delete $params->{'-excludes'} | ||||
606 | || delete $params->{'excludes'} | ||||
607 | || []; | ||||
608 | $excludes = [$excludes] unless ref($excludes) eq 'ARRAY'; | ||||
609 | |||||
610 | if (%$params) { | ||||
611 | warn "Roles with parameters cannot be cached. Consider " | ||||
612 | . "applying the parameters before calling " | ||||
613 | . "create_anon_class, or using 'weaken => 0' instead"; | ||||
614 | return; | ||||
615 | } | ||||
616 | |||||
617 | my $alias_key = join('%', | ||||
618 | map { $_ => $alias->{$_} } sort keys %$alias | ||||
619 | ); | ||||
620 | my $excludes_key = join('%', | ||||
621 | sort @$excludes | ||||
622 | ); | ||||
623 | $key .= '<' . join('+', 'a', $alias_key, 'e', $excludes_key) . '>'; | ||||
624 | } | ||||
625 | |||||
626 | push @role_keys, $key; | ||||
627 | } | ||||
628 | |||||
629 | # Makes something like Role|Role::1 | ||||
630 | return join('|', sort @role_keys); | ||||
631 | } | ||||
632 | |||||
633 | ##################################################################### | ||||
634 | ## NOTE: | ||||
635 | ## This is Moose::Meta::Role as defined by Moose (plus the use of | ||||
636 | ## MooseX::AttributeHelpers module). It is here as a reference to | ||||
637 | ## make it easier to see what is happening above with all the meta | ||||
638 | ## programming. - SL | ||||
639 | ##################################################################### | ||||
640 | # | ||||
641 | # has 'roles' => ( | ||||
642 | # metaclass => 'Array', | ||||
643 | # reader => 'get_roles', | ||||
644 | # isa => 'ArrayRef[Moose::Meta::Role]', | ||||
645 | # default => sub { [] }, | ||||
646 | # provides => { | ||||
647 | # 'push' => 'add_role', | ||||
648 | # } | ||||
649 | # ); | ||||
650 | # | ||||
651 | # has 'excluded_roles_map' => ( | ||||
652 | # metaclass => 'Hash', | ||||
653 | # reader => 'get_excluded_roles_map', | ||||
654 | # isa => 'HashRef[Str]', | ||||
655 | # provides => { | ||||
656 | # # Not exactly set, cause it sets multiple | ||||
657 | # 'set' => 'add_excluded_roles', | ||||
658 | # 'keys' => 'get_excluded_roles_list', | ||||
659 | # 'exists' => 'excludes_role', | ||||
660 | # } | ||||
661 | # ); | ||||
662 | # | ||||
663 | # has 'required_methods' => ( | ||||
664 | # metaclass => 'Hash', | ||||
665 | # reader => 'get_required_methods_map', | ||||
666 | # isa => 'HashRef[Moose::Meta::Role::Method::Required]', | ||||
667 | # provides => { | ||||
668 | # # not exactly set, or delete since it works for multiple | ||||
669 | # 'set' => 'add_required_methods', | ||||
670 | # 'delete' => 'remove_required_methods', | ||||
671 | # 'keys' => 'get_required_method_list', | ||||
672 | # 'exists' => 'requires_method', | ||||
673 | # } | ||||
674 | # ); | ||||
675 | # | ||||
676 | # # the before, around and after modifiers are | ||||
677 | # # HASH keyed by method-name, with ARRAY of | ||||
678 | # # CODE refs to apply in that order | ||||
679 | # | ||||
680 | # has 'before_method_modifiers' => ( | ||||
681 | # metaclass => 'Hash', | ||||
682 | # reader => 'get_before_method_modifiers_map', | ||||
683 | # isa => 'HashRef[ArrayRef[CodeRef]]', | ||||
684 | # provides => { | ||||
685 | # 'keys' => 'get_before_method_modifiers', | ||||
686 | # 'exists' => 'has_before_method_modifiers', | ||||
687 | # # This actually makes sure there is an | ||||
688 | # # ARRAY at the given key, and pushed onto | ||||
689 | # # it. It also checks for duplicates as well | ||||
690 | # # 'add' => 'add_before_method_modifier' | ||||
691 | # } | ||||
692 | # ); | ||||
693 | # | ||||
694 | # has 'after_method_modifiers' => ( | ||||
695 | # metaclass => 'Hash', | ||||
696 | # reader =>'get_after_method_modifiers_map', | ||||
697 | # isa => 'HashRef[ArrayRef[CodeRef]]', | ||||
698 | # provides => { | ||||
699 | # 'keys' => 'get_after_method_modifiers', | ||||
700 | # 'exists' => 'has_after_method_modifiers', | ||||
701 | # # This actually makes sure there is an | ||||
702 | # # ARRAY at the given key, and pushed onto | ||||
703 | # # it. It also checks for duplicates as well | ||||
704 | # # 'add' => 'add_after_method_modifier' | ||||
705 | # } | ||||
706 | # ); | ||||
707 | # | ||||
708 | # has 'around_method_modifiers' => ( | ||||
709 | # metaclass => 'Hash', | ||||
710 | # reader =>'get_around_method_modifiers_map', | ||||
711 | # isa => 'HashRef[ArrayRef[CodeRef]]', | ||||
712 | # provides => { | ||||
713 | # 'keys' => 'get_around_method_modifiers', | ||||
714 | # 'exists' => 'has_around_method_modifiers', | ||||
715 | # # This actually makes sure there is an | ||||
716 | # # ARRAY at the given key, and pushed onto | ||||
717 | # # it. It also checks for duplicates as well | ||||
718 | # # 'add' => 'add_around_method_modifier' | ||||
719 | # } | ||||
720 | # ); | ||||
721 | # | ||||
722 | # # override is similar to the other modifiers | ||||
723 | # # except that it is not an ARRAY of code refs | ||||
724 | # # but instead just a single name->code mapping | ||||
725 | # | ||||
726 | # has 'override_method_modifiers' => ( | ||||
727 | # metaclass => 'Hash', | ||||
728 | # reader =>'get_override_method_modifiers_map', | ||||
729 | # isa => 'HashRef[CodeRef]', | ||||
730 | # provides => { | ||||
731 | # 'keys' => 'get_override_method_modifier', | ||||
732 | # 'exists' => 'has_override_method_modifier', | ||||
733 | # 'add' => 'add_override_method_modifier', # checks for local method .. | ||||
734 | # } | ||||
735 | # ); | ||||
736 | # | ||||
737 | ##################################################################### | ||||
738 | |||||
739 | |||||
740 | 1 | 79µs | 1; | ||
741 | |||||
742 | # ABSTRACT: The Moose Role metaclass | ||||
743 | |||||
744 | __END__ |