| Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Module.pm |
| Statements | Executed 38 statements in 730µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 1 | 1 | 69µs | 475µs | Class::MOP::Module::create |
| 1 | 1 | 1 | 19µs | 40µs | Class::MOP::Module::BEGIN@4 |
| 2 | 1 | 1 | 17µs | 19µs | Class::MOP::Module::_instantiate_module |
| 1 | 1 | 1 | 16µs | 4.10ms | Class::MOP::Module::BEGIN@7 |
| 1 | 1 | 1 | 12µs | 18µ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 | 1µs | our $VERSION = '2.1403'; | ||
| 3 | |||||
| 4 | 2 | 49µs | 2 | 60µs | # spent 40µs (19+20) within Class::MOP::Module::BEGIN@4 which was called:
# once (19µs+20µs) by parent::import at line 4 # spent 40µs making 1 call to Class::MOP::Module::BEGIN@4
# spent 20µs making 1 call to strict::import |
| 5 | 2 | 38µs | 2 | 24µs | # spent 18µs (12+6) within Class::MOP::Module::BEGIN@5 which was called:
# once (12µs+6µs) by parent::import at line 5 # spent 18µs making 1 call to Class::MOP::Module::BEGIN@5
# spent 6µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 2 | 550µs | 2 | 4.10ms | # spent 4.10ms (16µs+4.08) within Class::MOP::Module::BEGIN@7 which was called:
# once (16µs+4.08ms) by parent::import at line 7 # spent 4.10ms making 1 call to Class::MOP::Module::BEGIN@7
# spent 4.08ms making 1 call to parent::import, recursion: max depth 1, sum of overlapping time 4.08ms |
| 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 475µs (69+406) within Class::MOP::Module::create which was called 2 times, avg 238µs/call:
# 2 times (69µs+406µs) by Class::MOP::Class::create at line 444 of Class/MOP/Class.pm, avg 238µs/call | ||||
| 49 | 20 | 64µs | my $class = shift; | ||
| 50 | my @args = @_; | ||||
| 51 | |||||
| 52 | unshift @args, 'package' if @args % 2 == 1; | ||||
| 53 | my %options = @args; | ||||
| 54 | |||||
| 55 | my $package = delete $options{package}; | ||||
| 56 | my $version = delete $options{version}; | ||||
| 57 | my $authority = delete $options{authority}; | ||||
| 58 | |||||
| 59 | 2 | 388µs | my $meta = $class->SUPER::create($package => %options); # spent 388µs making 2 calls to Class::MOP::Package::create, avg 194µs/call | ||
| 60 | |||||
| 61 | 2 | 19µs | $meta->_instantiate_module($version, $authority); # spent 19µs making 2 calls to Class::MOP::Module::_instantiate_module, avg 9µs/call | ||
| 62 | |||||
| 63 | 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 19µs (17+2) within Class::MOP::Module::_instantiate_module which was called 2 times, avg 9µs/call:
# 2 times (17µs+2µs) by Class::MOP::Module::create at line 61, avg 9µs/call | ||||
| 78 | 10 | 21µs | my($self, $version, $authority) = @_; | ||
| 79 | 2 | 2µs | my $package_name = $self->name; # spent 2µs making 2 calls to Class::MOP::Package::name, avg 800ns/call | ||
| 80 | |||||
| 81 | $self->add_package_symbol('$VERSION' => $version) | ||||
| 82 | if defined $version; | ||||
| 83 | $self->add_package_symbol('$AUTHORITY' => $authority) | ||||
| 84 | if defined $authority; | ||||
| 85 | |||||
| 86 | return; | ||||
| 87 | } | ||||
| 88 | |||||
| 89 | 1 | 6µs | 1; | ||
| 90 | |||||
| 91 | # ABSTRACT: Module Meta Object | ||||
| 92 | |||||
| 93 | __END__ |