| Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/metaclass.pm |
| Statements | Executed 231 statements in 955µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 20 | 20 | 20 | 457µs | 13.1ms | metaclass::import |
| 1 | 1 | 1 | 20µs | 40µs | metaclass::BEGIN@4 |
| 1 | 1 | 1 | 14µs | 53µs | metaclass::BEGIN@7 |
| 1 | 1 | 1 | 13µs | 20µs | metaclass::BEGIN@5 |
| 1 | 1 | 1 | 8µs | 8µs | metaclass::BEGIN@8 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package metaclass; | ||||
| 2 | 1 | 1µs | our $VERSION = '2.1403'; | ||
| 3 | |||||
| 4 | 2 | 39µs | 2 | 61µs | # spent 40µs (20+20) within metaclass::BEGIN@4 which was called:
# once (20µs+20µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 4 # spent 40µs making 1 call to metaclass::BEGIN@4
# spent 20µs making 1 call to strict::import |
| 5 | 2 | 46µs | 2 | 27µs | # spent 20µs (13+7) within metaclass::BEGIN@5 which was called:
# once (13µs+7µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 5 # spent 20µs making 1 call to metaclass::BEGIN@5
# spent 7µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 2 | 39µs | 2 | 92µs | # spent 53µs (14+39) within metaclass::BEGIN@7 which was called:
# once (14µs+39µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 7 # spent 53µs making 1 call to metaclass::BEGIN@7
# spent 39µs making 1 call to Module::Runtime::import |
| 8 | 2 | 341µs | 1 | 8µs | # spent 8µs within metaclass::BEGIN@8 which was called:
# once (8µs+0s) by Moose::Meta::TypeConstraint::BEGIN@6 at line 8 # spent 8µs making 1 call to metaclass::BEGIN@8 |
| 9 | |||||
| 10 | # spent 13.1ms (457µs+12.6) within metaclass::import which was called 20 times, avg 654µs/call:
# once (65µs+2.93ms) by Moose::Object::BEGIN@16 at line 15 of if.pm
# once (39µs+965µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint.pm
# once (24µs+668µs) by Moose::Meta::Role::Composite::BEGIN@6 at line 6 of Moose/Meta/Role/Composite.pm
# once (21µs+590µs) by Moose::Meta::TypeCoercion::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion.pm
# once (23µs+556µs) by Moose::Meta::TypeConstraint::Union::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Union.pm
# once (21µs+557µs) by Moose::Meta::Role::Application::BEGIN@6 at line 6 of Moose/Meta/Role/Application.pm
# once (18µs+521µs) by Moose::Meta::Role::Method::Required::BEGIN@6 at line 6 of Moose/Meta/Role/Method/Required.pm
# once (19µs+495µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@6 at line 6 of Moose/Meta/Role/Application/RoleSummation.pm
# once (22µs+484µs) by Moose::Meta::Role::BEGIN@6 at line 6 of Moose/Meta/Role.pm
# once (19µs+482µs) by Moose::Meta::TypeConstraint::Class::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Class.pm
# once (16µs+480µs) by Moose::Meta::Role::Application::ToInstance::BEGIN@6 at line 6 of Moose/Meta/Role/Application/ToInstance.pm
# once (27µs+460µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (17µs+453µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/DuckType.pm
# once (17µs+451µs) by Moose::Meta::Role::Application::ToRole::BEGIN@6 at line 6 of Moose/Meta/Role/Application/ToRole.pm
# once (17µs+448µs) by Moose::Meta::Role::Application::ToClass::BEGIN@6 at line 6 of Moose/Meta/Role/Application/ToClass.pm
# once (17µs+439µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Registry.pm
# once (16µs+436µs) by Moose::Meta::TypeConstraint::Role::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Role.pm
# once (26µs+402µs) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (16µs+411µs) by Moose::Meta::TypeConstraint::Enum::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Enum.pm
# once (15µs+391µs) by Moose::Meta::TypeCoercion::Union::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion/Union.pm | ||||
| 11 | 20 | 30µs | my ( $class, @args ) = @_; | ||
| 12 | |||||
| 13 | 20 | 16µs | unshift @args, "metaclass" if @args % 2 == 1; | ||
| 14 | 20 | 13µs | my %options = @args; | ||
| 15 | |||||
| 16 | 20 | 11µs | my $meta_name = exists $options{meta_name} ? $options{meta_name} : 'meta'; | ||
| 17 | 20 | 9µs | my $metaclass = delete $options{metaclass}; | ||
| 18 | |||||
| 19 | 20 | 10µs | unless ( defined $metaclass ) { | ||
| 20 | $metaclass = "Class::MOP::Class"; | ||||
| 21 | } else { | ||||
| 22 | 1 | 2µs | 1 | 71µs | use_package_optimistically($metaclass); # spent 71µs making 1 call to Module::Runtime::use_package_optimistically |
| 23 | } | ||||
| 24 | |||||
| 25 | 20 | 145µs | 20 | 29µs | ($metaclass->isa('Class::MOP::Class')) # spent 29µs making 20 calls to UNIVERSAL::isa, avg 1µs/call |
| 26 | || die use_module('Moose::Exception::MetaclassMustBeDerivedFromClassMOPClass')->new( class_name => $metaclass ); | ||||
| 27 | |||||
| 28 | # make sure the custom metaclasses get loaded | ||||
| 29 | 20 | 43µs | foreach my $key (grep { /_(?:meta)?class$/ } keys %options) { | ||
| 30 | unless ( ref( my $class = $options{$key} ) ) { | ||||
| 31 | use_package_optimistically($class) | ||||
| 32 | } | ||||
| 33 | } | ||||
| 34 | |||||
| 35 | 20 | 17µs | my $package = caller(); | ||
| 36 | |||||
| 37 | # create a meta object so we can install &meta | ||||
| 38 | 20 | 53µs | 20 | 3.22ms | my $meta = $metaclass->initialize($package => %options); # spent 1.81ms making 19 calls to Class::MOP::Class::initialize, avg 95µs/call
# spent 1.42ms making 1 call to Moose::Meta::Class::initialize |
| 39 | 20 | 135µs | 20 | 9.30ms | $meta->_add_meta_method($meta_name) # spent 9.30ms making 20 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 465µs/call |
| 40 | if defined $meta_name; | ||||
| 41 | } | ||||
| 42 | |||||
| 43 | 1 | 5µs | 1; | ||
| 44 | |||||
| 45 | # ABSTRACT: a pragma for installing and using Class::MOP metaclasses | ||||
| 46 | |||||
| 47 | __END__ |