| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Attribute/Native.pm |
| Statements | Executed 44 statements in 702µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Attribute::Native::__ANON__[:26] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Attribute::Native; | ||||
| 2 | |||||
| 3 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 4 | 1 | 60µs | $VERSION = eval $VERSION; # spent 12µs executing statements in string eval | ||
| 5 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 6 | |||||
| 7 | 1 | 10µs | my @trait_names = qw(Bool Counter Number String Array Hash Code); | ||
| 8 | |||||
| 9 | 1 | 7µs | for my $trait_name (@trait_names) { | ||
| 10 | 28 | 426µs | my $trait_class = "Moose::Meta::Attribute::Native::Trait::$trait_name"; | ||
| 11 | 7 | 4.14ms | my $meta = Class::MOP::Class->initialize( # spent 4.14ms making 7 calls to Class::MOP::Class::initialize, avg 591µs/call | ||
| 12 | "Moose::Meta::Attribute::Custom::Trait::$trait_name" | ||||
| 13 | ); | ||||
| 14 | 7 | 3.09ms | if ($meta->find_method_by_name('register_implementation')) { # spent 3.09ms making 7 calls to Class::MOP::Class::find_method_by_name, avg 442µs/call | ||
| 15 | my $class = $meta->name->register_implementation; | ||||
| 16 | Moose->throw_error( | ||||
| 17 | "An implementation for $trait_name already exists " . | ||||
| 18 | "(found '$class' when trying to register '$trait_class')" | ||||
| 19 | ); | ||||
| 20 | } | ||||
| 21 | $meta->add_method(register_implementation => sub { | ||||
| 22 | # resolve_metatrait_alias will load classes anyway, but throws away | ||||
| 23 | # their error message; we WANT to die if there's a problem | ||||
| 24 | 10 | 145µs | 5 | 3.34s | Class::MOP::load_class($trait_class); # spent 3.34s making 5 calls to Class::MOP::load_class, avg 669ms/call |
| 25 | return $trait_class; | ||||
| 26 | 7 | 3.25ms | }); # spent 3.25ms making 7 calls to Class::MOP::Mixin::HasMethods::add_method, avg 464µs/call | ||
| 27 | } | ||||
| 28 | |||||
| 29 | 1 | 46µs | 1; | ||
| 30 | |||||
| 31 | __END__ |