← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:09 2010

File /usr/local/lib/perl/5.10.0/Class/MOP/Mixin/HasMethods.pm
Statements Executed 15545
Total Time 0.0539557999999999 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
39320810.9ms46.5msClass::MOP::Mixin::HasMethods::::add_methodClass::MOP::Mixin::HasMethods::add_method
8132110.2ms47.9msClass::MOP::Mixin::HasMethods::::_get_maybe_raw_methodClass::MOP::Mixin::HasMethods::_get_maybe_raw_method
609644.39ms45.3msClass::MOP::Mixin::HasMethods::::get_methodClass::MOP::Mixin::HasMethods::get_method
1031423.98ms3.98msClass::MOP::Mixin::HasMethods::::_method_mapClass::MOP::Mixin::HasMethods::_method_map
204641.66ms13.9msClass::MOP::Mixin::HasMethods::::has_methodClass::MOP::Mixin::HasMethods::has_method
178111.42ms2.64msClass::MOP::Mixin::HasMethods::::_code_is_mineClass::MOP::Mixin::HasMethods::_code_is_mine
6411873µs4.37msClass::MOP::Mixin::HasMethods::::wrap_method_bodyClass::MOP::Mixin::HasMethods::wrap_method_body
3154662µs24.0msClass::MOP::Mixin::HasMethods::::_add_meta_methodClass::MOP::Mixin::HasMethods::_add_meta_method
711564µs7.46msClass::MOP::Mixin::HasMethods::::get_method_listClass::MOP::Mixin::HasMethods::get_method_list
911325µs6.46msClass::MOP::Mixin::HasMethods::::_get_local_methodsClass::MOP::Mixin::HasMethods::_get_local_methods
2521112µs112µsClass::MOP::Mixin::HasMethods::::_meta_method_classClass::MOP::Mixin::HasMethods::_meta_method_class
0000s0sClass::MOP::Mixin::HasMethods::::BEGINClass::MOP::Mixin::HasMethods::BEGIN
0000s0sClass::MOP::Mixin::HasMethods::::_restore_metamethods_fromClass::MOP::Mixin::HasMethods::_restore_metamethods_from
0000s0sClass::MOP::Mixin::HasMethods::::remove_methodClass::MOP::Mixin::HasMethods::remove_method
LineStmts.Exclusive
Time
Avg.Code
1package Class::MOP::Mixin::HasMethods;
2
3324µs8µsuse strict;
# spent 12µs making 1 call to strict::import
4328µs9µsuse warnings;
# spent 22µs making 1 call to warnings::import
5
63147µs49µsuse Class::MOP::Method::Meta;
# spent 9µs making 1 call to import
7
81700ns700nsour $VERSION = '1.09';
9128µs28µs$VERSION = eval $VERSION;
101600ns600nsour $AUTHORITY = 'cpan:STEVAN';
11
12331µs10µsuse Scalar::Util 'blessed';
# spent 39µs making 1 call to Exporter::import
13324µs8µsuse Carp 'confess';
# spent 34µs making 1 call to Exporter::import
143132µs44µsuse Sub::Name 'subname';
# spent 54µs making 1 call to Exporter::import
15
1631.17ms391µsuse base 'Class::MOP::Mixin';
# spent 68µs making 1 call to base::import
17
18256557µs2µssub method_metaclass { $_[0]->{'method_metaclass'} }
19238502µs2µssub wrapped_method_metaclass { $_[0]->{'wrapped_method_metaclass'} }
202535µs1µs
# spent 112µs within Class::MOP::Mixin::HasMethods::_meta_method_class which was called 25 times, avg 4µs/call: # 23 times (102µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 30, avg 4µs/call # 2 times (10µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 28, avg 5µs/call
sub _meta_method_class { 'Class::MOP::Method::Meta' }
21
22
# spent 24.0ms (662µs+23.3) within Class::MOP::Mixin::HasMethods::_add_meta_method which was called 31 times, avg 774µs/call: # 20 times (340µs+14.0ms) by metaclass::import at line 46 of /usr/local/lib/perl/5.10.0/metaclass.pm, avg 715µs/call # 7 times (116µs+5.40ms) by Moose::init_meta at line 214 of /usr/local/lib/perl/5.10.0/Moose.pm, avg 788µs/call # 2 times (55µs+1.30ms) by Class::MOP::Class::create at line 524 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 678µs/call # once (106µs+1.85ms) at line 671 of /usr/local/lib/perl/5.10.0/Class/MOP.pm # once (46µs+834µs) at line 677 of /usr/local/lib/perl/5.10.0/Class/MOP.pm
sub _add_meta_method {
231551.12ms7µs my $self = shift;
24 my ($name) = @_;
25 my $existing_method = $self->can('find_method_by_name')
# spent 3.85ms making 31 calls to Class::MOP::Class::find_method_by_name, avg 124µs/call # spent 117µs making 31 calls to UNIVERSAL::can, avg 4µs/call
26 ? $self->find_method_by_name($name)
27 : $self->get_method($name);
28 return if $existing_method
# spent 10µs making 2 calls to Class::MOP::Mixin::HasMethods::_meta_method_class, avg 5µs/call # spent 8µs making 2 calls to UNIVERSAL::isa, avg 4µs/call
29 && $existing_method->isa($self->_meta_method_class);
30 $self->add_method(
# spent 9.59ms making 23 calls to Class::MOP::Method::Meta::wrap, avg 417µs/call # spent 5.69ms making 8 calls to Moose::Meta::Method::Meta::wrap, avg 711µs/call # spent 3.85ms making 31 calls to Class::MOP::Mixin::HasMethods::add_method, avg 124µs/call # spent 102µs making 23 calls to Class::MOP::Mixin::HasMethods::_meta_method_class, avg 4µs/call # spent 77µs making 31 calls to Class::MOP::Package::name, avg 2µs/call # spent 39µs making 8 calls to Moose::Meta::Class::_meta_method_class, avg 5µs/call
31 $name => $self->_meta_method_class->wrap(
32 name => $name,
33 package_name => $self->name,
34 associated_metaclass => $self,
35 )
36 );
37}
38
39# This doesn't always get initialized in a constructor because there is a
40# weird object construction path for subclasses of Class::MOP::Class. At one
41# point, this always got initialized by calling into the XS code first, but
42# that is no longer guaranteed to happen.
4310312.02ms2µs
# spent 3.98ms within Class::MOP::Mixin::HasMethods::_method_map which was called 1031 times, avg 4µs/call: # 569 times (2.14ms+0s) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 136, avg 4µs/call # 393 times (1.59ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 82, avg 4µs/call # 49 times (170µs+0s) by Class::MOP::Mixin::HasMethods::get_method at line 126, avg 3µs/call # 20 times (83µs+0s) by Class::MOP::Class::Immutable::Trait::_method_map at line 80 of /usr/local/lib/perl/5.10.0/Class/MOP/Class/Immutable/Trait.pm, avg 4µs/call
sub _method_map { $_[0]->{'methods'} ||= {} }
44
45
# spent 4.37ms (873µs+3.50) within Class::MOP::Mixin::HasMethods::wrap_method_body which was called 64 times, avg 68µs/call: # 64 times (873µs+3.50ms) by Class::MOP::Mixin::HasMethods::get_method at line 126, avg 68µs/call
sub wrap_method_body {
461921.16ms6µs my ( $self, %args ) = @_;
47
48 ( 'CODE' eq ref $args{body} )
49 || confess "Your code block must be a CODE reference";
50
51 $self->method_metaclass->wrap(
# spent 3.05ms making 64 calls to Class::MOP::Method::wrap, avg 48µs/call # spent 291µs making 64 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 5µs/call # spent 155µs making 64 calls to Class::MOP::Package::name, avg 2µs/call
52 package_name => $self->name,
53 %args,
54 );
55}
56
57
# spent 46.5ms (10.9+35.5) within Class::MOP::Mixin::HasMethods::add_method which was called 393 times, avg 118µs/call: # 151 times (4.10ms+13.7ms) by Class::MOP::Attribute::install_accessors at line 360 of /usr/local/lib/perl/5.10.0/Class/MOP/Attribute.pm, avg 118µs/call # 46 times (1.19ms+3.90ms) by Class::MOP::Class::__ANON__[/usr/local/lib/perl/5.10.0/Class/MOP/Class.pm:935] at line 933 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 111µs/call # 38 times (1.16ms+3.82ms) by Class::MOP::Class::_inline_constructor at line 1307 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 131µs/call # 38 times (1.15ms+3.77ms) by Class::MOP::Attribute::install_accessors at line 356 of /usr/local/lib/perl/5.10.0/Class/MOP/Attribute.pm, avg 129µs/call # 36 times (908µs+2.98ms) by Class::MOP::Attribute::install_accessors at line 368 of /usr/local/lib/perl/5.10.0/Class/MOP/Attribute.pm, avg 108µs/call # 31 times (922µs+2.93ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 30, avg 124µs/call # 10 times (288µs+1.02ms) by Class::MOP::MiniTrait::apply at line 25 of /usr/local/lib/perl/5.10.0/Class/MOP/MiniTrait.pm, avg 131µs/call # 9 times (249µs+751µs) by Class::MOP::Attribute::install_accessors at line 364 of /usr/local/lib/perl/5.10.0/Class/MOP/Attribute.pm, avg 111µs/call # 7 times (258µs+671µs) by Class::MOP::Class::_inline_destructor at line 1340 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 133µs/call # 7 times (154µs+517µs) by Moose::Meta::Attribute::Native::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Attribute/Native.pm:26] at line 26 of /usr/local/lib/perl/5.10.0/Moose/Meta/Attribute/Native.pm, avg 96µs/call # 4 times (147µs+375µs) by Moose::Meta::Class::add_override_method_modifier at line 313 of /usr/local/lib/perl/5.10.0/Moose/Meta/Class.pm, avg 130µs/call # 3 times (63µs+207µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:288] at line 288 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm, avg 90µs/call # 3 times (69µs+192µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:315] at line 315 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm, avg 87µs/call # 3 times (68µs+189µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:296] at line 296 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm, avg 86µs/call # 2 times (57µs+142µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:116] at line 116 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm, avg 100µs/call # once (35µs+81µs) by Class::MOP::__ANON__[/usr/local/lib/perl/5.10.0/Class/MOP.pm:516] at line 516 of /usr/local/lib/perl/5.10.0/Class/MOP.pm # once (26µs+77µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:101] at line 101 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm # once (28µs+70µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:106] at line 106 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm # once (29µs+66µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:121] at line 121 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm # once (27µs+68µs) by Moose::Meta::Role::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm:96] at line 96 of /usr/local/lib/perl/5.10.0/Moose/Meta/Role.pm
sub add_method {
58353713.1ms4µs my ( $self, $method_name, $method ) = @_;
59 ( defined $method_name && length $method_name )
60 || confess "You must define a method name";
61
62 my $package_name = $self->name;
# spent 1.12ms making 393 calls to Class::MOP::Package::name, avg 3µs/call
63
64 my $body;
6511334.27ms4µs if ( blessed($method) ) {
# spent 1.21ms making 393 calls to Scalar::Util::blessed, avg 3µs/call
66 $body = $method->body;
# spent 924µs making 370 calls to Class::MOP::Method::body, avg 2µs/call
67 if ( $method->package_name ne $package_name ) {
# spent 895µs making 370 calls to Class::MOP::Method::package_name, avg 2µs/call # spent 208µs making 10 calls to Class::MOP::Method::clone, avg 21µs/call # spent 34µs making 10 calls to UNIVERSAL::can, avg 3µs/call
68 $method = $method->clone(
69 package_name => $package_name,
70 name => $method_name,
71 ) if $method->can('clone');
72 }
73
74 $method->attach_to_class($self);
# spent 3.40ms making 370 calls to Class::MOP::Method::attach_to_class, avg 9µs/call
75 }
76 else {
77 # If a raw code reference is supplied, its method object is not created.
78 # The method object won't be created until required.
79 $body = $method;
80 }
81
82 $self->_method_map->{$method_name} = $method;
# spent 1.59ms making 393 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 4µs/call
83
84 my ( $current_package, $current_name ) = Class::MOP::get_code_info($body);
# spent 1.55ms making 393 calls to Class::MOP::get_code_info, avg 4µs/call
85
866523.88ms6µs if ( !defined $current_name || $current_name =~ /^__ANON__/ ) {
87 my $full_method_name = ( $package_name . '::' . $method_name );
88 subname( $full_method_name => $body );
# spent 3.18ms making 326 calls to Sub::Name::subname, avg 10µs/call
89 }
90
91 $self->add_package_symbol(
92 { sigil => '&', type => 'CODE', name => $method_name },
# spent 21.4ms making 393 calls to Class::MOP::Package::add_package_symbol, avg 55µs/call
93 $body,
94 );
95}
96
97
# spent 2.64ms (1.42+1.22) within Class::MOP::Mixin::HasMethods::_code_is_mine which was called 178 times, avg 15µs/call: # 178 times (1.42ms+1.22ms) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 153, avg 15µs/call
sub _code_is_mine {
985342.28ms4µs my ( $self, $code ) = @_;
99
100 my ( $code_package, $code_name ) = Class::MOP::get_code_info($code);
# spent 790µs making 178 calls to Class::MOP::get_code_info, avg 4µs/call
101
102 return $code_package && $code_package eq $self->name
# spent 430µs making 178 calls to Class::MOP::Package::name, avg 2µs/call
103 || ( $code_package eq 'constant' && $code_name eq '__ANON__' );
104}
105
106
# spent 13.9ms (1.66+12.2) within Class::MOP::Mixin::HasMethods::has_method which was called 204 times, avg 68µs/call: # 108 times (830µs+5.95ms) by Class::MOP::Mixin::HasMethods::get_method_list at line 189, avg 63µs/call # 38 times (324µs+2.93ms) by Class::MOP::Class::_inline_constructor at line 1284 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 86µs/call # 36 times (291µs+2.02ms) by Class::MOP::Class::find_all_methods_by_name at line 1019 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 64µs/call # 11 times (119µs+462µs) by Moose::Meta::Attribute::_process_accessors at line 566 of /usr/local/lib/perl/5.10.0/Moose/Meta/Attribute.pm, avg 53µs/call # 7 times (59µs+499µs) by Class::MOP::Class::_inline_destructor at line 1319 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 80µs/call # 4 times (39µs+372µs) by Moose::Meta::Class::add_override_method_modifier at line 310 of /usr/local/lib/perl/5.10.0/Moose/Meta/Class.pm, avg 103µs/call
sub has_method {
1076121.52ms2µs my ( $self, $method_name ) = @_;
108
109 ( defined $method_name && length $method_name )
110 || confess "You must define a method name";
111
112 return defined( $self->_get_maybe_raw_method($method_name) );
# spent 12.2ms making 204 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 60µs/call
113}
114
115
# spent 45.3ms (4.39+40.9) within Class::MOP::Mixin::HasMethods::get_method which was called 609 times, avg 74µs/call: # 301 times (2.07ms+21.7ms) by Class::MOP::Class::find_method_by_name at line 986 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 79µs/call # 175 times (1.31ms+10.6ms) by Class::MOP::Class::find_next_method_by_name at line 1035 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 68µs/call # 69 times (566µs+5.44ms) by Class::MOP::Mixin::HasMethods::_get_local_methods at line 203, avg 87µs/call # 46 times (277µs+1.75ms) by Class::MOP::Class::__ANON__[/usr/local/lib/perl/5.10.0/Class/MOP/Class.pm:935] at line 910 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 44µs/call # 11 times (103µs+890µs) by Moose::Meta::Attribute::_process_accessors at line 557 of /usr/local/lib/perl/5.10.0/Moose/Meta/Attribute.pm, avg 90µs/call # 7 times (58µs+524µs) by Moose::init_meta at line 204 of /usr/local/lib/perl/5.10.0/Moose.pm, avg 83µs/call
sub get_method {
11621105.07ms2µs my ( $self, $method_name ) = @_;
117
118 ( defined $method_name && length $method_name )
119 || confess "You must define a method name";
120
121 my $method = $self->_get_maybe_raw_method($method_name)
# spent 35.6ms making 609 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 59µs/call
122 or return;
123
124 return $method if blessed $method;
# spent 532µs making 219 calls to Scalar::Util::blessed, avg 2µs/call
125
126 return $self->_method_map->{$method_name} = $self->wrap_method_body(
# spent 4.37ms making 64 calls to Class::MOP::Mixin::HasMethods::wrap_method_body, avg 68µs/call # spent 188µs making 13 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 14µs/call # spent 170µs making 49 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 3µs/call # spent 35µs making 2 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::_method_map, avg 17µs/call
127 body => $method,
128 name => $method_name,
129 associated_metaclass => $self,
130 );
131}
132
133
# spent 47.9ms (10.2+37.7) within Class::MOP::Mixin::HasMethods::_get_maybe_raw_method which was called 813 times, avg 59µs/call: # 609 times (7.62ms+28.0ms) by Class::MOP::Mixin::HasMethods::get_method at line 121, avg 59µs/call # 204 times (2.57ms+9.67ms) by Class::MOP::Mixin::HasMethods::has_method at line 112, avg 60µs/call
sub _get_maybe_raw_method {
134478915.6ms3µs my ( $self, $method_name ) = @_;
135
136 my $method_map = $self->_method_map;
# spent 3.10ms making 216 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 14µs/call # spent 2.14ms making 569 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 4µs/call # spent 1.40ms making 28 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::_method_map, avg 50µs/call
137 my $map_entry = $method_map->{$method_name};
138 my $code = $self->get_package_symbol(
# spent 25.2ms making 813 calls to Class::MOP::Package::get_package_symbol, avg 31µs/call
139 {
140 name => $method_name,
141 sigil => '&',
142 type => 'CODE',
143 }
144 );
145
146 # The !$code case seems to happen in some weird cases where methods
147 # modifiers are added via roles or some other such bizareness. Honestly, I
148 # don't totally understand this, but returning the entry works, and keeps
149 # various MX modules from blowing up. - DR
150 return $map_entry
# spent 2.66ms making 813 calls to Scalar::Util::blessed, avg 3µs/call # spent 505µs making 163 calls to Class::MOP::Method::body, avg 3µs/call
151 if blessed $map_entry && ( !$code || $map_entry->body == $code );
152
153 unless ($map_entry) {
# spent 2.64ms making 178 calls to Class::MOP::Mixin::HasMethods::_code_is_mine, avg 15µs/call
154 return unless $code && $self->_code_is_mine($code);
155 }
156
157 return $code;
158}
159
160sub remove_method {
161 my ( $self, $method_name ) = @_;
162 ( defined $method_name && length $method_name )
163 || confess "You must define a method name";
164
165 my $removed_method = delete $self->_full_method_map->{$method_name};
166
167 $self->remove_package_symbol(
168 { sigil => '&', type => 'CODE', name => $method_name } );
169
170 $removed_method->detach_from_class
171 if $removed_method && blessed $removed_method;
172
173 # still valid, since we just removed the method from the map
174 $self->update_package_cache_flag;
175
176 return $removed_method;
177}
178
179
# spent 7.46ms (564µs+6.89) within Class::MOP::Mixin::HasMethods::get_method_list which was called 7 times, avg 1.07ms/call: # 7 times (564µs+6.89ms) by namespace::autoclean::import or namespace::autoclean::__ANON__[/usr/local/share/perl/5.10.0/namespace/autoclean.pm:57] at line 45 of /usr/local/share/perl/5.10.0/namespace/autoclean.pm, avg 1.07ms/call
sub get_method_list {
18021176µs8µs my $self = shift;
181
182 my $namespace = $self->namespace;
# spent 110µs making 7 calls to Class::MOP::Package::namespace, avg 16µs/call
183
184 # Constants may show up as some sort of non-GLOB reference in the
185 # namespace hash ref, depending on the Perl version.
186 return grep {
187 defined $namespace->{$_}
188 && ( ref( \$namespace->{$_} ) ne 'GLOB'
189 || *{ $namespace->{$_} }{CODE} )
# spent 6.78ms making 108 calls to Class::MOP::Mixin::HasMethods::has_method, avg 63µs/call
190 && $self->has_method($_)
191 }
192139683µs5µs keys %{$namespace};
193}
194
195# This should probably be what get_method_list actually does, instead of just
196# returning names. This was created as a much faster alternative to
197# $meta->get_method($_) for $meta->get_method_list
198
# spent 6.46ms (325µs+6.14) within Class::MOP::Mixin::HasMethods::_get_local_methods which was called 9 times, avg 718µs/call: # 9 times (325µs+6.14ms) by Class::MOP::Class::get_all_methods at line 999 of /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm, avg 718µs/call
sub _get_local_methods {
19927235µs9µs my $self = shift;
200
201 my $namespace = $self->namespace;
# spent 130µs making 9 calls to Class::MOP::Package::namespace, avg 14µs/call
202
203 return map { $self->get_method($_) }
# spent 6.01ms making 69 calls to Class::MOP::Mixin::HasMethods::get_method, avg 87µs/call
204 grep {
205 defined $namespace->{$_}
206 && ( ref $namespace->{$_}
207 || *{ $namespace->{$_} }{CODE} )
208 }
20969236µs3µs keys %{$namespace};
210}
211
212sub _restore_metamethods_from {
213 my $self = shift;
214 my ($old_meta) = @_;
215
216 for my $method ($old_meta->_get_local_methods) {
217 $method->_make_compatible_with($self->method_metaclass);
218 $self->add_method($method->name => $method);
219 }
220}
221
22215µs5µs1;
223
224__END__
225
226=pod
227
228=head1 NAME
229
230Class::MOP::Mixin::HasMethods - Methods for metaclasses which have methods
231
232=head1 DESCRIPTION
233
234This class implements methods for metaclasses which have methods
235(L<Class::MOP::Package> and L<Moose::Meta::Role>). See L<Class::MOP::Package>
236for API details.
237
238=head1 AUTHORS
239
240Dave Rolsky E<lt>autarch@urth.orgE<gt>
241
242=head1 COPYRIGHT AND LICENSE
243
244Copyright 2006-2010 by Infinity Interactive, Inc.
245
246L<http://www.iinteractive.com>
247
248This library is free software; you can redistribute it and/or modify
249it under the same terms as Perl itself.
250
251=cut