| File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Class/MOP/Mixin/HasAttributes.pm |
| Statements Executed | 7701 |
| Statement Execution Time | 14.5ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 245 | 114 | 23 | 6.54ms | 125ms | Class::MOP::Mixin::HasAttributes::add_attribute |
| 2418 | 8 | 2 | 2.53ms | 2.53ms | Class::MOP::Mixin::HasAttributes::_attribute_map |
| 473 | 4 | 4 | 2.06ms | 2.59ms | Class::MOP::Mixin::HasAttributes::has_attribute |
| 293 | 4 | 3 | 1.26ms | 1.51ms | Class::MOP::Mixin::HasAttributes::get_attribute |
| 59 | 4 | 3 | 295µs | 368µs | Class::MOP::Mixin::HasAttributes::get_attribute_list |
| 147 | 6 | 3 | 237µs | 237µs | Class::MOP::Mixin::HasAttributes::attribute_metaclass |
| 1 | 1 | 1 | 15µs | 18µs | Class::MOP::Mixin::HasAttributes::BEGIN@3 |
| 1 | 1 | 1 | 13µs | 14µs | Class::MOP::Mixin::HasAttributes::remove_attribute |
| 1 | 1 | 1 | 8µs | 37µs | Class::MOP::Mixin::HasAttributes::BEGIN@10 |
| 1 | 1 | 1 | 7µs | 17µs | Class::MOP::Mixin::HasAttributes::BEGIN@4 |
| 1 | 1 | 1 | 7µs | 31µs | Class::MOP::Mixin::HasAttributes::BEGIN@11 |
| 1 | 1 | 1 | 7µs | 55µs | Class::MOP::Mixin::HasAttributes::BEGIN@13 |
| 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 (15+3) within Class::MOP::Mixin::HasAttributes::BEGIN@3 which was called
# once (15µs+3µs) by Class::MOP::BEGIN@16 at line 3 # spent 18µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@3
# spent 3µs making 1 call to strict::import |
| 4 | 3 | 43µs | 2 | 27µs | # spent 17µs (7+10) within Class::MOP::Mixin::HasAttributes::BEGIN@4 which was called
# once (7µs+10µs) by Class::MOP::BEGIN@16 at line 4 # spent 17µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@4
# spent 10µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 700ns | our $VERSION = '0.98'; | ||
| 7 | 1 | 14µs | $VERSION = eval $VERSION; | ||
| 8 | 1 | 400ns | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | 3 | 32µs | 2 | 66µs | # spent 37µs (8+29) within Class::MOP::Mixin::HasAttributes::BEGIN@10 which was called
# once (8µs+29µs) by Class::MOP::BEGIN@16 at line 10 # spent 37µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@10
# spent 29µs making 1 call to Exporter::import |
| 11 | 3 | 24µs | 2 | 55µs | # spent 31µs (7+24) within Class::MOP::Mixin::HasAttributes::BEGIN@11 which was called
# once (7µs+24µs) by Class::MOP::BEGIN@16 at line 11 # spent 31µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@11
# spent 24µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | 3 | 303µs | 2 | 103µs | # spent 55µs (7+48) within Class::MOP::Mixin::HasAttributes::BEGIN@13 which was called
# once (7µs+48µs) by Class::MOP::BEGIN@16 at line 13 # spent 55µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@13
# spent 48µs making 1 call to base::import |
| 14 | |||||
| 15 | 2418 | 4.60ms | # spent 2.53ms within Class::MOP::Mixin::HasAttributes::_attribute_map which was called 2418 times, avg 1µs/call:
# 1101 times (1.29ms+0s) by Class::MOP::Class::get_all_attributes at line 551 of Class/MOP/Class.pm, avg 1µs/call
# 473 times (534µs+0s) by Class::MOP::Mixin::HasAttributes::has_attribute at line 57, avg 1µs/call
# 293 times (248µs+0s) by Class::MOP::Mixin::HasAttributes::get_attribute at line 66, avg 846ns/call
# 245 times (198µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 35, avg 808ns/call
# 245 times (194µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 38, avg 791ns/call
# 59 times (73µs+0s) by Class::MOP::Mixin::HasAttributes::get_attribute_list at line 85, avg 1µs/call
# once (700ns+0s) by Class::MOP::Mixin::HasAttributes::remove_attribute at line 75
# once (700ns+0s) by Class::MOP::Mixin::HasAttributes::remove_attribute at line 78 | ||
| 16 | 147 | 374µs | # spent 237µs within Class::MOP::Mixin::HasAttributes::attribute_metaclass which was called 147 times, avg 2µs/call:
# 80 times (114µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21, avg 1µs/call
# 49 times (83µs+0s) by Moose::Meta::Class::_process_new_attribute at line 607 of Moose/Meta/Class.pm, avg 2µs/call
# 13 times (30µs+0s) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 132 of Moose/Meta/Role/Application/ToClass.pm, avg 2µs/call
# 2 times (5µs+0s) by Moose::Meta::Class::reinitialize at line 151 of Moose/Meta/Class.pm, avg 3µs/call
# 2 times (4µs+0s) by List::MoreUtils::all at line 407 of Moose/Meta/Class.pm, avg 2µs/call
# once (1µs+0s) by Moose::Meta::Class::_reinitialize_with at line 418 of Moose/Meta/Class.pm | ||
| 17 | |||||
| 18 | # spent 125ms (6.54+119) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 245 times, avg 511µs/call:
# 86 times (2.41ms+87.9ms) by Moose::Meta::Class::add_attribute at line 300 of Moose/Meta/Class.pm, avg 1.05ms/call
# 44 times (973µs+1.12ms) by Moose::Meta::Role::add_attribute at line 201 of Moose/Meta/Role.pm, avg 47µs/call
# 3 times (105µs+813µs) by Moose::BEGIN@26 at line 257 of Moose/Meta/Role.pm, avg 306µs/call
# 2 times (60µs+530µs) by Moose::BEGIN@26 at line 84 of Moose/Meta/Role.pm, avg 295µs/call
# once (29µs+1.52ms) by Moose::BEGIN@20 at line 20 of Moose/Meta/TypeCoercion.pm
# once (53µs+526µs) by Moose::BEGIN@18 at line 30 of Moose/Meta/Class.pm
# once (31µs+538µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 16 of Moose/Meta/TypeConstraint/Registry.pm
# once (62µs+474µs) by Moose::Exporter::BEGIN@11 at line 177 of Class/MOP.pm
# once (28µs+505µs) by base::import at line 35 of Moose/Meta/Mixin/AttributeCore.pm
# once (46µs+419µs) by Moose::BEGIN@26 at line 148 of Moose/Meta/Role.pm
# once (39µs+415µs) by Moose::Meta::TypeCoercion::BEGIN@8 at line 22 of Moose/Meta/Attribute.pm
# once (28µs+385µs) by Moose::BEGIN@19 at line 31 of Moose/Meta/TypeConstraint.pm
# once (27µs+383µs) by base::import at line 42 of Moose/Meta/Mixin/AttributeCore.pm
# once (28µs+379µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 17 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (28µs+374µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 15 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (27µs+374µs) by Moose::BEGIN@19 at line 21 of Moose/Meta/TypeConstraint.pm
# once (27µs+369µs) by Moose::BEGIN@19 at line 41 of Moose/Meta/TypeConstraint.pm
# once (28µs+365µs) by base::import at line 23 of Moose/Meta/Mixin/AttributeCore.pm
# once (27µs+361µs) by Moose::BEGIN@19 at line 32 of Moose/Meta/TypeConstraint.pm
# once (28µs+360µs) by base::import at line 29 of Moose/Meta/Mixin/AttributeCore.pm
# once (27µs+356µs) by Moose::BEGIN@19 at line 54 of Moose/Meta/TypeConstraint.pm
# once (26µs+351µs) by Moose::BEGIN@19 at line 36 of Moose/Meta/TypeConstraint.pm
# once (30µs+343µs) by Moose::Meta::Role::BEGIN@19 at line 20 of Moose/Meta/Role/Method/Required.pm
# once (22µs+349µs) by Moose::Exporter::BEGIN@11 at line 467 of Class/MOP.pm
# once (28µs+334µs) by Moose::BEGIN@19 at line 20 of Moose/Meta/TypeConstraint.pm
# once (35µs+293µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 19 of Moose/Meta/TypeConstraint/Union.pm
# once (43µs+285µs) by base::import at line 11 of Moose/Meta/Mixin/AttributeCore.pm
# once (32µs+291µs) by Moose::BEGIN@26 at line 142 of Moose/Meta/Role.pm
# once (32µs+266µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 15 of Moose/Meta/TypeConstraint/Enum.pm
# once (30µs+258µs) by Moose::BEGIN@26 at line 119 of Moose/Meta/Role.pm
# once (29µs+258µs) by Moose::BEGIN@29 at line 20 of Moose/Meta/Role/Application/RoleSummation.pm
# once (32µs+255µs) by Moose::Meta::Role::BEGIN@17 at line 15 of Moose/Meta/Role/Attribute.pm
# once (32µs+253µs) by Moose::Exporter::BEGIN@11 at line 653 of Class/MOP.pm
# once (28µs+257µs) by base::import at line 12 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+263µs) by Moose::Exporter::BEGIN@11 at line 446 of Class/MOP.pm
# once (29µs+255µs) by Moose::Exporter::BEGIN@11 at line 405 of Class/MOP.pm
# once (30µs+252µs) by Moose::BEGIN@26 at line 136 of Moose/Meta/Role.pm
# once (29µs+253µs) by Moose::BEGIN@30 at line 16 of Moose/Meta/Role/Application/ToClass.pm
# once (28µs+253µs) by Moose::BEGIN@27 at line 31 of Moose/Meta/Role/Composite.pm
# once (29µs+251µs) by Moose::BEGIN@30 at line 20 of Moose/Meta/Role/Application/ToClass.pm
# once (28µs+251µs) by Moose::BEGIN@26 at line 302 of Moose/Meta/Role.pm
# once (29µs+248µs) by Moose::BEGIN@28 at line 15 of Moose/Meta/Role/Application.pm
# once (29µs+246µs) by base::import at line 20 of Moose/Meta/Mixin/AttributeCore.pm
# once (28µs+246µs) by Moose::BEGIN@20 at line 28 of Moose/Meta/TypeCoercion.pm
# once (28µs+245µs) by Moose::Util::TypeConstraints::BEGIN@33 at line 16 of Moose/Meta/TypeConstraint/Role.pm
# once (29µs+243µs) by Moose::BEGIN@20 at line 18 of Moose/Meta/TypeCoercion.pm
# once (28µs+243µs) by Moose::BEGIN@28 at line 21 of Moose/Meta/Role/Application.pm
# once (23µs+249µs) by Moose::Exporter::BEGIN@11 at line 558 of Class/MOP.pm
# once (29µs+242µs) by Moose::BEGIN@32 at line 18 of Moose/Meta/Role/Application/ToInstance.pm
# once (28µs+243µs) by Moose::BEGIN@26 at line 353 of Moose/Meta/Role.pm
# once (38µs+232µs) by Moose::Exporter::BEGIN@11 at line 237 of Class/MOP.pm
# once (28µs+242µs) by Moose::Meta::Role::BEGIN@20 at line 15 of Moose/Meta/Role/Method/Conflicting.pm
# once (28µs+242µs) by Moose::BEGIN@26 at line 130 of Moose/Meta/Role.pm
# once (32µs+235µs) by Moose::BEGIN@26 at line 124 of Moose/Meta/Role.pm
# once (28µs+237µs) by Moose::BEGIN@27 at line 21 of Moose/Meta/Role/Composite.pm
# once (28µs+238µs) by Moose::Util::TypeConstraints::BEGIN@32 at line 16 of Moose/Meta/TypeConstraint/Class.pm
# once (27µs+238µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 25 of Moose/Meta/TypeConstraint/Registry.pm
# once (27µs+237µs) by Moose::BEGIN@18 at line 35 of Moose/Meta/Class.pm
# once (27µs+236µs) by base::import at line 21 of Moose/Meta/Mixin/AttributeCore.pm
# once (28µs+235µs) by Moose::BEGIN@27 at line 33 of Moose/Meta/Role/Composite.pm
# once (22µs+241µs) by Moose::Exporter::BEGIN@11 at line 398 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 (26µs+236µs) by Moose::Exporter::BEGIN@11 at line 425 of Class/MOP.pm
# once (27µs+234µs) by base::import at line 16 of Moose/Meta/Mixin/AttributeCore.pm
# once (27µs+232µs) by Moose::Meta::Role::BEGIN@17 at line 33 of Moose/Meta/Role/Attribute.pm
# once (27µs+232µs) by Moose::BEGIN@18 at line 54 of Moose/Meta/Class.pm
# once (27µs+231µs) by Moose::Meta::Role::BEGIN@17 at line 21 of Moose/Meta/Role/Attribute.pm
# once (27µs+230µs) by Moose::BEGIN@18 at line 49 of Moose/Meta/Class.pm
# once (22µs+236µs) by Moose::Exporter::BEGIN@11 at line 432 of Class/MOP.pm
# once (27µs+229µs) by base::import at line 17 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+234µs) by Moose::Exporter::BEGIN@11 at line 412 of Class/MOP.pm
# once (27µs+228µs) by Moose::BEGIN@18 at line 44 of Moose/Meta/Class.pm
# once (27µs+227µs) by Moose::BEGIN@19 at line 58 of Moose/Meta/TypeConstraint.pm
# once (27µs+224µs) by base::import at line 13 of Moose/Meta/Mixin/AttributeCore.pm
# once (27µs+224µs) by Moose::Meta::Role::BEGIN@17 at line 27 of Moose/Meta/Role/Attribute.pm
# once (23µs+227µs) by Moose::Exporter::BEGIN@11 at line 439 of Class/MOP.pm
# once (27µs+223µs) by base::import at line 15 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+228µs) by Moose::Exporter::BEGIN@11 at line 453 of Class/MOP.pm
# once (27µs+222µs) by base::import at line 19 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+226µs) by Moose::Exporter::BEGIN@11 at line 529 of Class/MOP.pm
# once (22µs+223µs) by Moose::BEGIN@18 at line 37 of Moose/Meta/Class.pm
# once (22µs+214µs) by Moose::Exporter::BEGIN@11 at line 340 of Class/MOP.pm
# once (26µs+184µs) by Moose::Exporter::BEGIN@11 at line 261 of Class/MOP.pm
# once (24µs+178µs) by Moose::Exporter::BEGIN@11 at line 287 of Class/MOP.pm
# once (26µs+176µs) by Moose::Exporter::BEGIN@11 at line 505 of Class/MOP.pm
# once (23µs+177µs) by Moose::Exporter::BEGIN@11 at line 192 of Class/MOP.pm
# once (22µs+177µs) by Moose::Exporter::BEGIN@11 at line 517 of Class/MOP.pm
# once (22µs+176µs) by Moose::Exporter::BEGIN@11 at line 322 of Class/MOP.pm
# once (23µs+168µs) by Moose::Exporter::BEGIN@11 at line 610 of Class/MOP.pm
# once (25µs+164µs) by Moose::Exporter::BEGIN@11 at line 180 of Class/MOP.pm
# once (24µs+164µs) by Moose::Exporter::BEGIN@11 at line 306 of Class/MOP.pm
# once (22µs+164µs) by Moose::Exporter::BEGIN@11 at line 641 of Class/MOP.pm
# once (22µs+163µs) by Moose::Exporter::BEGIN@11 at line 419 of Class/MOP.pm
# once (27µs+159µs) by Moose::Exporter::BEGIN@11 at line 358 of Class/MOP.pm
# once (22µs+163µs) by Moose::Exporter::BEGIN@11 at line 584 of Class/MOP.pm
# once (22µs+162µs) by Moose::Exporter::BEGIN@11 at line 565 of Class/MOP.pm
# once (22µs+162µs) by Moose::Exporter::BEGIN@11 at line 349 of Class/MOP.pm
# once (22µs+161µs) by Moose::Exporter::BEGIN@11 at line 477 of Class/MOP.pm
# once (22µs+160µs) by Moose::Exporter::BEGIN@11 at line 384 of Class/MOP.pm
# once (22µs+160µs) by Moose::Exporter::BEGIN@11 at line 575 of Class/MOP.pm
# once (22µs+160µs) by Moose::Exporter::BEGIN@11 at line 607 of Class/MOP.pm
# once (22µs+158µ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 647 of Class/MOP.pm
# once (26µs+153µs) by Moose::Exporter::BEGIN@11 at line 511 of Class/MOP.pm
# once (22µs+157µs) by Moose::Exporter::BEGIN@11 at line 460 of Class/MOP.pm
# once (22µs+156µs) by Moose::Exporter::BEGIN@11 at line 219 of Class/MOP.pm
# once (22µs+156µs) by Moose::Exporter::BEGIN@11 at line 626 of Class/MOP.pm
# once (22µs+152µs) by Moose::Exporter::BEGIN@11 at line 495 of Class/MOP.pm
# once (22µs+151µs) by Moose::Exporter::BEGIN@11 at line 368 of Class/MOP.pm
# once (22µs+151µs) by Moose::Exporter::BEGIN@11 at line 222 of Class/MOP.pm
# once (22µs+151µs) by Moose::Exporter::BEGIN@11 at line 325 of Class/MOP.pm
# once (21µs+151µs) by Moose::Exporter::BEGIN@11 at line 523 of Class/MOP.pm
# once (21µs+150µs) by Moose::Exporter::BEGIN@11 at line 632 of Class/MOP.pm
# once (22µs+79µs) by Moose::Exporter::BEGIN@11 at line 551 of Class/MOP.pm | ||||
| 19 | 2695 | 5.99ms | my $self = shift; | ||
| 20 | |||||
| 21 | my $attribute # spent 1.46ms making 66 calls to Class::MOP::Attribute::new, avg 22µs/call
# spent 156µs making 245 calls to Scalar::Util::blessed, avg 637ns/call
# spent 130µs making 14 calls to Moose::Meta::Role::Attribute::new, avg 9µs/call
# spent 114µs making 80 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 1µs/call | ||||
| 22 | = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_); | ||||
| 23 | |||||
| 24 | ( $attribute->isa('Class::MOP::Mixin::AttributeCore') ) # spent 228µs making 245 calls to UNIVERSAL::isa, avg 929ns/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 2.45ms making 201 calls to Class::MOP::Class::_attach_attribute, avg 12µs/call
# spent 496µs making 44 calls to Moose::Meta::Role::_attach_attribute, avg 11µs/call | ||||
| 29 | |||||
| 30 | my $attr_name = $attribute->name; # spent 177µs making 245 calls to Class::MOP::Mixin::AttributeCore::name, avg 722ns/call | ||||
| 31 | |||||
| 32 | $self->remove_attribute($attr_name) # spent 1.23ms making 245 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 5µs/call
# spent 14µs making 1 call to Class::MOP::Mixin::HasAttributes::remove_attribute | ||||
| 33 | if $self->has_attribute($attr_name); | ||||
| 34 | |||||
| 35 | my $order = ( scalar keys %{ $self->_attribute_map } ); # spent 198µs making 245 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 808ns/call | ||||
| 36 | $attribute->_set_insertion_order($order); # spent 325µs making 245 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 1µs/call | ||||
| 37 | |||||
| 38 | $self->_attribute_map->{$attr_name} = $attribute; # spent 194µs making 245 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 791ns/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 111ms making 201 calls to Class::MOP::Class::_post_add_attribute, avg 554µs/call
# spent 242µs making 245 calls to UNIVERSAL::can, avg 989ns/call | ||||
| 46 | if $self->can('_post_add_attribute'); | ||||
| 47 | |||||
| 48 | return $attribute; | ||||
| 49 | } | ||||
| 50 | |||||
| 51 | # spent 2.59ms (2.06+534µs) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 473 times, avg 5µs/call:
# 245 times (948µs+279µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 32, avg 5µs/call
# 161 times (821µs+198µs) by Class::MOP::Class::find_attribute_by_name at line 542 of Class/MOP/Class.pm, avg 6µs/call
# 37 times (173µs+35µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 136 of Moose/Meta/Role/Application/ToClass.pm, avg 6µs/call
# 30 times (116µs+21µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 56 of Moose/Meta/Role/Application/ToRole.pm, avg 5µs/call | ||||
| 52 | 1419 | 1.74ms | 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 534µs making 473 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 1µs/call | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | # spent 1.51ms (1.26+248µs) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 293 times, avg 5µs/call:
# 158 times (693µs+134µs) by Class::MOP::Class::find_attribute_by_name at line 542 of Class/MOP/Class.pm, avg 5µs/call
# 68 times (294µs+58µs) by Class::MOP::Class::_inline_accessors at line 1030 of Class/MOP/Class.pm, avg 5µs/call
# 37 times (160µs+27µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 142 of Moose/Meta/Role/Application/ToClass.pm, avg 5µs/call
# 30 times (116µs+29µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 65 of Moose/Meta/Role/Application/ToRole.pm, avg 5µs/call | ||||
| 61 | 879 | 1.04ms | 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 248µs making 293 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 846ns/call | ||||
| 67 | } | ||||
| 68 | |||||
| 69 | # spent 14µs (13+1) within Class::MOP::Mixin::HasAttributes::remove_attribute which was called
# once (13µs+1µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 32 | ||||
| 70 | 6 | 10µs | 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}; # spent 700ns making 1 call to Class::MOP::Mixin::HasAttributes::_attribute_map | ||||
| 76 | return unless defined $removed_attribute; | ||||
| 77 | |||||
| 78 | delete $self->_attribute_map->{$attribute_name}; # spent 700ns making 1 call to Class::MOP::Mixin::HasAttributes::_attribute_map | ||||
| 79 | |||||
| 80 | return $removed_attribute; | ||||
| 81 | } | ||||
| 82 | |||||
| 83 | # spent 368µs (295+73) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 59 times, avg 6µs/call:
# 32 times (142µs+35µs) by Class::MOP::Class::_inline_accessors at line 1029 of Class/MOP/Class.pm, avg 6µs/call
# 13 times (89µs+21µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 134 of Moose/Meta/Role/Application/ToClass.pm, avg 9µs/call
# 13 times (58µs+16µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 54 of Moose/Meta/Role/Application/ToRole.pm, avg 6µs/call
# once (5µs+1µs) by Class::MOP::Class::is_pristine at line 854 of Class/MOP/Class.pm | ||||
| 84 | 118 | 252µs | my $self = shift; | ||
| 85 | keys %{ $self->_attribute_map }; # spent 73µs making 59 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 1µs/call | ||||
| 86 | } | ||||
| 87 | |||||
| 88 | 1 | 9µ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 |