| Filename | /usr/local/lib/perl/5.18.2/Class/MOP/Module.pm |
| Statements | Executed 188 statements in 562µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 12 | 1 | 1 | 167µs | 9.71ms | Class::MOP::Module::create |
| 12 | 1 | 1 | 58µs | 62µs | Class::MOP::Module::_instantiate_module |
| 1 | 1 | 1 | 9µs | 18µs | Class::MOP::Module::BEGIN@4 |
| 1 | 1 | 1 | 6µs | 2.37ms | Class::MOP::Module::BEGIN@7 |
| 1 | 1 | 1 | 5µs | 8µs | Class::MOP::Module::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Module::_anon_cache_key |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Module::_anon_package_prefix |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Module::_new |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Module::identifier |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Class::MOP::Module; | ||||
| 2 | 1 | 400ns | our $VERSION = '2.1604'; | ||
| 3 | |||||
| 4 | 2 | 18µs | 2 | 26µs | # spent 18µs (9+9) within Class::MOP::Module::BEGIN@4 which was called:
# once (9µs+9µs) by parent::import at line 4 # spent 18µs making 1 call to Class::MOP::Module::BEGIN@4
# spent 9µs making 1 call to strict::import |
| 5 | 2 | 18µs | 2 | 11µs | # spent 8µs (5+3) within Class::MOP::Module::BEGIN@5 which was called:
# once (5µs+3µs) by parent::import at line 5 # spent 8µs making 1 call to Class::MOP::Module::BEGIN@5
# spent 3µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 2 | 303µs | 2 | 2.37ms | # spent 2.37ms (6µs+2.36) within Class::MOP::Module::BEGIN@7 which was called:
# once (6µs+2.36ms) by parent::import at line 7 # spent 2.37ms making 1 call to Class::MOP::Module::BEGIN@7
# spent 2.36ms making 1 call to parent::import, recursion: max depth 1, sum of overlapping time 2.36ms |
| 8 | |||||
| 9 | sub _new { | ||||
| 10 | my $class = shift; | ||||
| 11 | return Class::MOP::Class->initialize($class)->new_object(@_) | ||||
| 12 | if $class ne __PACKAGE__; | ||||
| 13 | |||||
| 14 | my $params = @_ == 1 ? $_[0] : {@_}; | ||||
| 15 | return bless { | ||||
| 16 | # Need to quote package to avoid a problem with PPI mis-parsing this | ||||
| 17 | # as a package statement. | ||||
| 18 | |||||
| 19 | # from Class::MOP::Package | ||||
| 20 | 'package' => $params->{package}, | ||||
| 21 | namespace => \undef, | ||||
| 22 | |||||
| 23 | # attributes | ||||
| 24 | version => \undef, | ||||
| 25 | authority => \undef | ||||
| 26 | } => $class; | ||||
| 27 | } | ||||
| 28 | |||||
| 29 | sub version { | ||||
| 30 | my $self = shift; | ||||
| 31 | ${$self->get_or_add_package_symbol('$VERSION')}; | ||||
| 32 | } | ||||
| 33 | |||||
| 34 | sub authority { | ||||
| 35 | my $self = shift; | ||||
| 36 | ${$self->get_or_add_package_symbol('$AUTHORITY')}; | ||||
| 37 | } | ||||
| 38 | |||||
| 39 | sub identifier { | ||||
| 40 | my $self = shift; | ||||
| 41 | join '-' => ( | ||||
| 42 | $self->name, | ||||
| 43 | ($self->version || ()), | ||||
| 44 | ($self->authority || ()), | ||||
| 45 | ); | ||||
| 46 | } | ||||
| 47 | |||||
| 48 | # spent 9.71ms (167µs+9.55) within Class::MOP::Module::create which was called 12 times, avg 809µs/call:
# 12 times (167µs+9.55ms) by Class::MOP::Class::create at line 444 of Class/MOP/Class.pm, avg 809µs/call | ||||
| 49 | 12 | 6µs | my $class = shift; | ||
| 50 | 12 | 9µs | my @args = @_; | ||
| 51 | |||||
| 52 | 12 | 12µs | unshift @args, 'package' if @args % 2 == 1; | ||
| 53 | 12 | 23µs | my %options = @args; | ||
| 54 | |||||
| 55 | 12 | 8µs | my $package = delete $options{package}; | ||
| 56 | 12 | 6µs | my $version = delete $options{version}; | ||
| 57 | 12 | 5µs | my $authority = delete $options{authority}; | ||
| 58 | |||||
| 59 | 12 | 28µs | 12 | 9.48ms | my $meta = $class->SUPER::create($package => %options); # spent 9.48ms making 12 calls to Class::MOP::Package::create, avg 790µs/call |
| 60 | |||||
| 61 | 12 | 29µs | 12 | 62µs | $meta->_instantiate_module($version, $authority); # spent 62µs making 12 calls to Class::MOP::Module::_instantiate_module, avg 5µs/call |
| 62 | |||||
| 63 | 12 | 29µs | return $meta; | ||
| 64 | } | ||||
| 65 | |||||
| 66 | sub _anon_package_prefix { 'Class::MOP::Module::__ANON__::SERIAL::' } | ||||
| 67 | |||||
| 68 | sub _anon_cache_key { | ||||
| 69 | my $class = shift; | ||||
| 70 | my %options = @_; | ||||
| 71 | $class->_throw_exception( PackagesAndModulesAreNotCachable => class_name => $class, | ||||
| 72 | params => \%options, | ||||
| 73 | is_module => 1 | ||||
| 74 | ); | ||||
| 75 | } | ||||
| 76 | |||||
| 77 | # spent 62µs (58+5) within Class::MOP::Module::_instantiate_module which was called 12 times, avg 5µs/call:
# 12 times (58µs+5µs) by Class::MOP::Module::create at line 61, avg 5µs/call | ||||
| 78 | 12 | 5µs | my($self, $version, $authority) = @_; | ||
| 79 | 12 | 33µs | 12 | 5µs | my $package_name = $self->name; # spent 5µs making 12 calls to Class::MOP::Package::name, avg 392ns/call |
| 80 | |||||
| 81 | 12 | 3µs | $self->add_package_symbol('$VERSION' => $version) | ||
| 82 | if defined $version; | ||||
| 83 | 12 | 3µs | $self->add_package_symbol('$AUTHORITY' => $authority) | ||
| 84 | if defined $authority; | ||||
| 85 | |||||
| 86 | 12 | 22µs | return; | ||
| 87 | } | ||||
| 88 | |||||
| 89 | 1 | 2µs | 1; | ||
| 90 | |||||
| 91 | # ABSTRACT: Module Meta Object | ||||
| 92 | |||||
| 93 | __END__ |