Profile of /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Class/MOP/Mixin/HasAttributes.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For 01.HTTP.t
Run on Tue May 4 15:25:55 2010
Reported on Tue May 4 15:26:15 2010

File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Class/MOP/Mixin/HasAttributes.pm
Statements Executed | 3191
Statement Execution Time | 6.60ms

Subroutines — ordered by exclusive time
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
119 | 113 | 23 | 3.27ms | 36.4ms | Class::MOP::Mixin::HasAttributes::::add_attributeClass::MOP::Mixin::HasAttributes::add_attribute
862 | 6 | 2 | 838µs | 838µs | Class::MOP::Mixin::HasAttributes::::_attribute_mapClass::MOP::Mixin::HasAttributes::_attribute_map
170 | 2 | 2 | 659µs | 848µs | Class::MOP::Mixin::HasAttributes::::has_attributeClass::MOP::Mixin::HasAttributes::has_attribute
119 | 2 | 1 | 477µs | 576µs | Class::MOP::Mixin::HasAttributes::::get_attributeClass::MOP::Mixin::HasAttributes::get_attribute
32 | 1 | 1 | 150µs | 186µs | Class::MOP::Mixin::HasAttributes::::get_attribute_listClass::MOP::Mixin::HasAttributes::get_attribute_list
70 | 2 | 2 | 98µs | 98µs | Class::MOP::Mixin::HasAttributes::::attribute_metaclassClass::MOP::Mixin::HasAttributes::attribute_metaclass
1 | 1 | 1 | 14µs | 18µs | Class::MOP::Mixin::HasAttributes::::BEGIN@3Class::MOP::Mixin::HasAttributes::BEGIN@3
1 | 1 | 1 | 8µs | 39µs | Class::MOP::Mixin::HasAttributes::::BEGIN@10Class::MOP::Mixin::HasAttributes::BEGIN@10
1 | 1 | 1 | 8µs | 18µs | Class::MOP::Mixin::HasAttributes::::BEGIN@4Class::MOP::Mixin::HasAttributes::BEGIN@4
1 | 1 | 1 | 7µs | 30µs | Class::MOP::Mixin::HasAttributes::::BEGIN@11Class::MOP::Mixin::HasAttributes::BEGIN@11
1 | 1 | 1 | 6µs | 47µs | Class::MOP::Mixin::HasAttributes::::BEGIN@13Class::MOP::Mixin::HasAttributes::BEGIN@13
0 | 0 | 0 | 0s | 0s | Class::MOP::Mixin::HasAttributes::::remove_attributeClass::MOP::Mixin::HasAttributes::remove_attribute

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Class::MOP::Mixin::HasAttributes;
2 |  |  |  |  |
3 | 3 | 23µs | 2 | 21µs | # spent 18µs (14+3) within Class::MOP::Mixin::HasAttributes::BEGIN@3 which was called # once (14µs+3µs) by Class::MOP::BEGIN@16 at line 3 use strict; # spent 18µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@3 # spent 3µs making 1 call to strict::import
4 | 3 | 42µs | 2 | 29µs | # spent 18µs (8+10) within Class::MOP::Mixin::HasAttributes::BEGIN@4 which was called # once (8µs+10µs) by Class::MOP::BEGIN@16 at line 4 use warnings; # spent 18µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@4 # spent 11µs making 1 call to warnings::import
5 |  |  |  |  |
6 | 1 | 1µs |  |  | our $VERSION = '0.98';
7 | 1 | 21µs |  |  | $VERSION = eval $VERSION;
8 | 1 | 400ns |  |  | our $AUTHORITY = 'cpan:STEVAN';
9 |  |  |  |  |
10 | 3 | 24µs | 2 | 70µs | # spent 39µs (8+31) within Class::MOP::Mixin::HasAttributes::BEGIN@10 which was called # once (8µs+31µs) by Class::MOP::BEGIN@16 at line 10 use Carp 'confess'; # spent 39µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@10 # spent 31µs making 1 call to Exporter::import
11 | 3 | 24µs | 2 | 53µs | # spent 30µs (7+23) within Class::MOP::Mixin::HasAttributes::BEGIN@11 which was called # once (7µs+23µs) by Class::MOP::BEGIN@16 at line 11 use Scalar::Util 'blessed'; # spent 30µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@11 # spent 23µs making 1 call to Exporter::import
12 |  |  |  |  |
13 | 3 | 667µs | 2 | 88µs | # spent 47µs (6+41) within Class::MOP::Mixin::HasAttributes::BEGIN@13 which was called # once (6µs+41µs) by Class::MOP::BEGIN@16 at line 13 use base 'Class::MOP::Mixin'; # spent 47µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@13 # spent 41µs making 1 call to base::import
14 |  |  |  |  |
15 | 862 | 1.56ms |  |  | # spent 838µs within Class::MOP::Mixin::HasAttributes::_attribute_map which was called 862 times, avg 972ns/call: # 303 times (330µs+0s) by Class::MOP::Class::get_all_attributes at line 551 of Class/MOP/Class.pm, avg 1µs/call # 170 times (189µs+0s) by Class::MOP::Mixin::HasAttributes::has_attribute at line 57, avg 1µs/call # 119 times (99µs+0s) by Class::MOP::Mixin::HasAttributes::get_attribute at line 66, avg 832ns/call # 119 times (93µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 35, avg 781ns/call # 119 times (90µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 38, avg 753ns/call # 32 times (36µs+0s) by Class::MOP::Mixin::HasAttributes::get_attribute_list at line 85, avg 1µs/call sub _attribute_map { $_[0]->{'attributes'} }
16 | 70 | 160µs |  |  | # spent 98µs within Class::MOP::Mixin::HasAttributes::attribute_metaclass which was called 70 times, avg 1µs/call: # 66 times (90µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21, avg 1µs/call # 4 times (8µs+0s) by Moose::Meta::Class::_process_new_attribute at line 607 of Moose/Meta/Class.pm, avg 2µs/call sub attribute_metaclass { $_[0]->{'attribute_metaclass'} }
17 |  |  |  |  |
18 |  |  |  |  | # spent 36.4ms (3.27+33.1) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 119 times, avg 306µs/call: # 4 times (149µs+3.30ms) by Moose::Meta::Class::add_attribute at line 300 of Moose/Meta/Class.pm, avg 862µs/call # 3 times (88µs+724µs) by Moose::BEGIN@26 at line 257 of Moose/Meta/Role.pm, avg 271µs/call # 2 times (93µs+798µs) by Moose::BEGIN@26 at line 84 of Moose/Meta/Role.pm, avg 445µs/call # once (29µs+1.53ms) by Moose::BEGIN@20 at line 20 of Moose/Meta/TypeCoercion.pm # once (53µs+544µs) by Moose::BEGIN@18 at line 30 of Moose/Meta/Class.pm # once (62µs+530µs) by Moose::Exporter::BEGIN@11 at line 177 of Class/MOP.pm # once (29µs+528µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 16 of Moose/Meta/TypeConstraint/Registry.pm # once (27µs+500µs) by base::import at line 35 of Moose/Meta/Mixin/AttributeCore.pm # once (29µs+441µs) by Moose::Meta::TypeCoercion::BEGIN@8 at line 22 of Moose/Meta/Attribute.pm # once (34µs+387µs) by Moose::BEGIN@19 at line 20 of Moose/Meta/TypeConstraint.pm # once (29µs+387µs) by Moose::Meta::Role::BEGIN@19 at line 20 of Moose/Meta/Role/Method/Required.pm # once (27µs+385µs) by Moose::BEGIN@19 at line 41 of Moose/Meta/TypeConstraint.pm # once (28µs+383µs) by Moose::BEGIN@19 at line 31 of Moose/Meta/TypeConstraint.pm # once (28µs+370µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 17 of Moose/Meta/TypeConstraint/Parameterized.pm # once (28µs+369µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 15 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (26µs+370µs) by Moose::BEGIN@19 at line 32 of Moose/Meta/TypeConstraint.pm # once (28µs+366µs) by base::import at line 23 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+365µs) by Moose::BEGIN@19 at line 21 of Moose/Meta/TypeConstraint.pm # once (28µs+363µs) by base::import at line 42 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+351µs) by base::import at line 29 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+351µs) by Moose::BEGIN@19 at line 36 of Moose/Meta/TypeConstraint.pm # once (27µs+351µs) by Moose::BEGIN@19 at line 54 of Moose/Meta/TypeConstraint.pm # once (44µs+303µs) by base::import at line 11 of Moose/Meta/Mixin/AttributeCore.pm # once (28µs+317µs) by Moose::BEGIN@26 at line 136 of Moose/Meta/Role.pm # once (23µs+320µs) by Moose::Exporter::BEGIN@11 at line 467 of Class/MOP.pm # once (36µs+299µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 19 of Moose/Meta/TypeConstraint/Union.pm # once (23µs+305µs) by Moose::Exporter::BEGIN@11 at line 405 of Class/MOP.pm # once (33µs+288µs) by Moose::BEGIN@26 at line 142 of Moose/Meta/Role.pm # once (31µs+290µs) by Moose::BEGIN@27 at line 33 of Moose/Meta/Role/Composite.pm # once (36µs+284µs) by Moose::Meta::Role::BEGIN@17 at line 15 of Moose/Meta/Role/Attribute.pm # once (24µs+282µs) by Moose::Exporter::BEGIN@11 at line 432 of Class/MOP.pm # once (29µs+271µs) by Moose::BEGIN@29 at line 20 of Moose/Meta/Role/Application/RoleSummation.pm # once (32µs+259µs) by Moose::BEGIN@26 at line 119 of Moose/Meta/Role.pm # once (30µs+259µs) by Moose::BEGIN@27 at line 21 of Moose/Meta/Role/Composite.pm # once (31µs+257µs) by Moose::BEGIN@32 at line 18 of Moose/Meta/Role/Application/ToInstance.pm # once (25µs+261µs) by Moose::Exporter::BEGIN@11 at line 439 of Class/MOP.pm # once (28µs+252µs) by Moose::BEGIN@26 at line 353 of Moose/Meta/Role.pm # once (32µs+248µs) by Moose::BEGIN@26 at line 148 of Moose/Meta/Role.pm # once (28µs+250µs) by Moose::Util::TypeConstraints::BEGIN@33 at line 16 of Moose/Meta/TypeConstraint/Role.pm # once (29µs+248µs) by Moose::BEGIN@30 at line 16 of Moose/Meta/Role/Application/ToClass.pm # once (22µs+255µs) by Moose::Exporter::BEGIN@11 at line 453 of Class/MOP.pm # once (22µs+254µs) by Moose::Exporter::BEGIN@11 at line 529 of Class/MOP.pm # once (28µs+247µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 25 of Moose/Meta/TypeConstraint/Registry.pm # once (22µs+253µs) by Moose::Exporter::BEGIN@11 at line 558 of Class/MOP.pm # once (29µs+245µs) by Moose::BEGIN@20 at line 18 of Moose/Meta/TypeCoercion.pm # once (28µs+245µs) by Moose::BEGIN@20 at line 28 of Moose/Meta/TypeCoercion.pm # once (24µs+247µs) by Moose::Exporter::BEGIN@11 at line 412 of Class/MOP.pm # once (29µs+241µs) by Moose::Util::TypeConstraints::BEGIN@32 at line 16 of Moose/Meta/TypeConstraint/Class.pm # once (27µs+242µs) by Moose::BEGIN@19 at line 58 of Moose/Meta/TypeConstraint.pm # once (29µs+240µs) by Moose::Meta::Role::BEGIN@20 at line 15 of Moose/Meta/Role/Method/Conflicting.pm # once (29µs+239µs) by Moose::BEGIN@28 at line 15 of Moose/Meta/Role/Application.pm # once (27µs+240µs) by Moose::BEGIN@18 at line 54 of Moose/Meta/Class.pm # once (27µs+239µs) by Moose::BEGIN@27 at line 31 of Moose/Meta/Role/Composite.pm # once (23µs+242µs) by Moose::Exporter::BEGIN@11 at line 446 of Class/MOP.pm # once (27µs+238µs) by Moose::Meta::Role::BEGIN@17 at line 27 of Moose/Meta/Role/Attribute.pm # once (28µs+237µs) by base::import at line 20 of Moose/Meta/Mixin/AttributeCore.pm # once (28µs+236µs) by Moose::BEGIN@28 at line 21 of Moose/Meta/Role/Application.pm # once (28µs+235µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 15 of Moose/Meta/TypeConstraint/Enum.pm # once (22µs+241µs) by Moose::Exporter::BEGIN@11 at line 425 of Class/MOP.pm # once (28µs+234µs) by Moose::Util::TypeConstraints::BEGIN@35 at line 19 of Moose/Meta/TypeConstraint/DuckType.pm # once (22µs+237µs) by Moose::BEGIN@18 at line 37 of Moose/Meta/Class.pm # once (27µs+231µs) by base::import at line 12 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+229µs) by Moose::BEGIN@18 at line 44 of Moose/Meta/Class.pm # once (27µs+229µs) by base::import at line 15 of Moose/Meta/Mixin/AttributeCore.pm # once (28µs+228µs) by Moose::BEGIN@26 at line 302 of Moose/Meta/Role.pm # once (27µs+229µs) by base::import at line 19 of Moose/Meta/Mixin/AttributeCore.pm # once (22µs+234µs) by Moose::Exporter::BEGIN@11 at line 398 of Class/MOP.pm # once (27µs+228µs) by Moose::BEGIN@18 at line 35 of Moose/Meta/Class.pm # once (27µs+226µs) by Moose::BEGIN@30 at line 20 of Moose/Meta/Role/Application/ToClass.pm # once (28µs+224µs) by Moose::BEGIN@26 at line 124 of Moose/Meta/Role.pm # once (28µs+224µs) by Moose::Meta::Role::BEGIN@17 at line 21 of Moose/Meta/Role/Attribute.pm # once (27µs+224µs) by base::import at line 16 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+222µs) by Moose::BEGIN@26 at line 130 of Moose/Meta/Role.pm # once (27µs+222µs) by base::import at line 13 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+222µs) by Moose::Meta::Role::BEGIN@17 at line 33 of Moose/Meta/Role/Attribute.pm # once (27µs+222µs) by base::import at line 21 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+222µs) by base::import at line 17 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+222µs) by Moose::BEGIN@18 at line 49 of Moose/Meta/Class.pm # once (27µs+180µs) by Moose::Exporter::BEGIN@11 at line 632 of Class/MOP.pm # once (23µs+184µs) by Moose::Exporter::BEGIN@11 at line 322 of Class/MOP.pm # once (24µs+177µs) by Moose::Exporter::BEGIN@11 at line 607 of Class/MOP.pm # once (24µs+174µs) by Moose::Exporter::BEGIN@11 at line 641 of Class/MOP.pm # once (24µs+169µs) by Moose::Exporter::BEGIN@11 at line 575 of Class/MOP.pm # once (26µs+167µs) by Moose::Exporter::BEGIN@11 at line 460 of Class/MOP.pm # once (24µs+168µs) by Moose::Exporter::BEGIN@11 at line 626 of Class/MOP.pm # once (24µs+164µs) by Moose::Exporter::BEGIN@11 at line 419 of Class/MOP.pm # once (24µs+163µs) by Moose::Exporter::BEGIN@11 at line 384 of Class/MOP.pm # once (22µs+165µs) by Moose::Exporter::BEGIN@11 at line 349 of Class/MOP.pm # once (23µs+163µs) by Moose::Exporter::BEGIN@11 at line 219 of Class/MOP.pm # once (23µs+160µs) by Moose::Exporter::BEGIN@11 at line 180 of Class/MOP.pm # once (22µs+160µs) by Moose::Exporter::BEGIN@11 at line 261 of Class/MOP.pm # once (24µs+157µs) by Moose::Exporter::BEGIN@11 at line 517 of Class/MOP.pm # once (24µs+157µs) by Moose::Exporter::BEGIN@11 at line 592 of Class/MOP.pm # once (22µs+158µs) by Moose::Exporter::BEGIN@11 at line 653 of Class/MOP.pm # once (22µs+158µs) by Moose::Exporter::BEGIN@11 at line 495 of Class/MOP.pm # once (22µs+157µs) by Moose::Exporter::BEGIN@11 at line 222 of Class/MOP.pm # once (22µs+157µs) by Moose::Exporter::BEGIN@11 at line 523 of Class/MOP.pm # once (22µs+157µs) by Moose::Exporter::BEGIN@11 at line 358 of Class/MOP.pm # once (22µs+155µs) by Moose::Exporter::BEGIN@11 at line 511 of Class/MOP.pm # once (23µs+155µs) by Moose::Exporter::BEGIN@11 at line 505 of Class/MOP.pm # once (22µs+154µs) by Moose::Exporter::BEGIN@11 at line 477 of Class/MOP.pm # once (22µs+153µs) by Moose::Exporter::BEGIN@11 at line 584 of Class/MOP.pm # once (22µs+153µs) by Moose::Exporter::BEGIN@11 at line 647 of Class/MOP.pm # once (22µs+153µs) by Moose::Exporter::BEGIN@11 at line 237 of Class/MOP.pm # once (22µs+152µs) by Moose::Exporter::BEGIN@11 at line 340 of Class/MOP.pm # once (22µs+152µs) by Moose::Exporter::BEGIN@11 at line 287 of Class/MOP.pm # once (22µs+152µs) by Moose::Exporter::BEGIN@11 at line 368 of Class/MOP.pm # once (22µs+152µs) by Moose::Exporter::BEGIN@11 at line 192 of Class/MOP.pm # once (22µs+150µs) by Moose::Exporter::BEGIN@11 at line 610 of Class/MOP.pm # once (22µs+151µs) by Moose::Exporter::BEGIN@11 at line 565 of Class/MOP.pm # once (22µs+150µs) by Moose::Exporter::BEGIN@11 at line 325 of Class/MOP.pm # once (22µs+150µs) by Moose::Exporter::BEGIN@11 at line 306 of Class/MOP.pm # once (23µs+73µs) by Moose::Exporter::BEGIN@11 at line 551 of Class/MOP.pm sub add_attribute {
19 | 1309 | 3.01ms |  |  | my $self = shift;
20 |  |  |  |  |
21 |  |  |  |  | my $attribute # spent 1.46ms making 66 calls to Class::MOP::Attribute::new, avg 22µs/call # spent 90µs making 66 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 1µs/call # spent 67µs making 119 calls to Scalar::Util::blessed, avg 564ns/call
22 |  |  |  |  | = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_);
23 |  |  |  |  |
24 |  |  |  |  | ( $attribute->isa('Class::MOP::Mixin::AttributeCore') ) # spent 119µs making 119 calls to UNIVERSAL::isa, avg 1µs/call
25 |  |  |  |  | || confess
26 |  |  |  |  | "Your attribute must be an instance of Class::MOP::Mixin::AttributeCore (or a subclass)";
27 |  |  |  |  |
28 |  |  |  |  | $self->_attach_attribute($attribute); # spent 1.36ms making 119 calls to Class::MOP::Class::_attach_attribute, avg 11µs/call
29 |  |  |  |  |
30 |  |  |  |  | my $attr_name = $attribute->name; # spent 77µs making 119 calls to Class::MOP::Mixin::AttributeCore::name, avg 646ns/call
31 |  |  |  |  |
32 |  |  |  |  | $self->remove_attribute($attr_name) # spent 583µs making 119 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 5µs/call
33 |  |  |  |  | if $self->has_attribute($attr_name);
34 |  |  |  |  |
35 |  |  |  |  | my $order = ( scalar keys %{ $self->_attribute_map } ); # spent 93µs making 119 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 781ns/call
36 |  |  |  |  | $attribute->_set_insertion_order($order); # spent 142µs making 119 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 1µs/call
37 |  |  |  |  |
38 |  |  |  |  | $self->_attribute_map->{$attr_name} = $attribute; # spent 90µs making 119 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 753ns/call
39 |  |  |  |  |
40 |  |  |  |  | # This method is called to allow for installing accessors. Ideally, we'd
41 |  |  |  |  | # use method overriding, but then the subclass would be responsible for
42 |  |  |  |  | # making the attribute, which would end up with lots of code
43 |  |  |  |  | # duplication. Even more ideally, we'd use augment/inner, but this is
44 |  |  |  |  | # Class::MOP!
45 |  |  |  |  | $self->_post_add_attribute($attribute) # spent 28.9ms making 119 calls to Class::MOP::Class::_post_add_attribute, avg 243µs/call # spent 118µs making 119 calls to UNIVERSAL::can, avg 991ns/call
46 |  |  |  |  | if $self->can('_post_add_attribute');
47 |  |  |  |  |
48 |  |  |  |  | return $attribute;
49 |  |  |  |  | }
50 |  |  |  |  |
51 |  |  |  |  | # spent 848µs (659+189) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 170 times, avg 5µs/call: # 119 times (447µs+136µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 32, avg 5µs/call # 51 times (211µs+54µs) by Class::MOP::Class::find_attribute_by_name at line 542 of Class/MOP/Class.pm, avg 5µs/call sub has_attribute {
52 | 510 | 540µs |  |  | my ( $self, $attribute_name ) = @_;
53 |  |  |  |  |
54 |  |  |  |  | ( defined $attribute_name )
55 |  |  |  |  | || confess "You must define an attribute name";
56 |  |  |  |  |
57 |  |  |  |  | exists $self->_attribute_map->{$attribute_name}; # spent 189µs making 170 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 1µs/call
58 |  |  |  |  | }
59 |  |  |  |  |
60 |  |  |  |  | # spent 576µs (477+99) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 119 times, avg 5µs/call: # 68 times (301µs+61µs) by Class::MOP::Class::_inline_accessors at line 1030 of Class/MOP/Class.pm, avg 5µs/call # 51 times (175µs+38µs) by Class::MOP::Class::find_attribute_by_name at line 542 of Class/MOP/Class.pm, avg 4µs/call sub get_attribute {
61 | 357 | 398µs |  |  | my ( $self, $attribute_name ) = @_;
62 |  |  |  |  |
63 |  |  |  |  | ( defined $attribute_name )
64 |  |  |  |  | || confess "You must define an attribute name";
65 |  |  |  |  |
66 |  |  |  |  | return $self->_attribute_map->{$attribute_name}; # spent 99µs making 119 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 832ns/call
67 |  |  |  |  | }
68 |  |  |  |  |
69 |  |  |  |  | sub remove_attribute {
70 |  |  |  |  | my ( $self, $attribute_name ) = @_;
71 |  |  |  |  |
72 |  |  |  |  | ( defined $attribute_name )
73 |  |  |  |  | || confess "You must define an attribute name";
74 |  |  |  |  |
75 |  |  |  |  | my $removed_attribute = $self->_attribute_map->{$attribute_name};
76 |  |  |  |  | return unless defined $removed_attribute;
77 |  |  |  |  |
78 |  |  |  |  | delete $self->_attribute_map->{$attribute_name};
79 |  |  |  |  |
80 |  |  |  |  | return $removed_attribute;
81 |  |  |  |  | }
82 |  |  |  |  |
83 |  |  |  |  | # spent 186µs (150+36) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 32 times, avg 6µs/call: # 32 times (150µs+36µs) by Class::MOP::Class::_inline_accessors at line 1029 of Class/MOP/Class.pm, avg 6µs/call sub get_attribute_list {
84 | 64 | 113µs |  |  | my $self = shift;
85 |  |  |  |  | keys %{ $self->_attribute_map }; # spent 36µs making 32 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 1µs/call
86 |  |  |  |  | }
87 |  |  |  |  |
88 | 1 | 7µs |  |  | 1;
89 |  |  |  |  |
90 |  |  |  |  | __END__
91 |  |  |  |  |
92 |  |  |  |  | =pod
93 |  |  |  |  |
94 |  |  |  |  | =head1 NAME
95 |  |  |  |  |
96 |  |  |  |  | Class::MOP::Mixin::HasMethods - Methods for metaclasses which have attributes
97 |  |  |  |  |
98 |  |  |  |  | =head1 DESCRIPTION
99 |  |  |  |  |
100 |  |  |  |  | This class implements methods for metaclasses which have attributes
101 |  |  |  |  | (L<Class::MOP::Class> and L<Moose::Meta::Role>). See L<Class::MOP::Class> for
102 |  |  |  |  | API details.
103 |  |  |  |  |
104 |  |  |  |  | =head1 AUTHORS
105 |  |  |  |  |
106 |  |  |  |  | Dave Rolsky E<lt>autarch@urth.orgE<gt>
107 |  |  |  |  |
108 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
109 |  |  |  |  |
110 |  |  |  |  | Copyright 2006-2010 by Infinity Interactive, Inc.
111 |  |  |  |  |
112 |  |  |  |  | L<http://www.iinteractive.com>
113 |  |  |  |  |
114 |  |  |  |  | This library is free software; you can redistribute it and/or modify
115 |  |  |  |  | it under the same terms as Perl itself.
116 |  |  |  |  |
117 |  |  |  |  | =cut