| Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose.pm |
| Statements | Executed 275 statements in 3.00ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 3.73ms | 20.1ms | Moose::BEGIN@27 |
| 1 | 1 | 1 | 3.24ms | 81.8ms | Moose::BEGIN@18 |
| 1 | 1 | 1 | 3.04ms | 18.3ms | Moose::BEGIN@35 |
| 1 | 1 | 1 | 2.03ms | 7.27ms | Moose::BEGIN@28 |
| 1 | 1 | 1 | 1.39ms | 2.13ms | Moose::BEGIN@38 |
| 1 | 1 | 1 | 1.10ms | 4.90ms | Moose::BEGIN@39 |
| 1 | 1 | 1 | 1.03ms | 12.6ms | Moose::BEGIN@15 |
| 1 | 1 | 1 | 817µs | 2.82ms | Moose::BEGIN@33 |
| 1 | 1 | 1 | 812µs | 1.26ms | Moose::BEGIN@40 |
| 1 | 1 | 1 | 754µs | 2.05ms | Moose::BEGIN@36 |
| 1 | 1 | 1 | 631µs | 89.2ms | Moose::BEGIN@29 |
| 1 | 1 | 1 | 591µs | 1.51ms | Moose::BEGIN@37 |
| 1 | 1 | 1 | 499µs | 757µs | Moose::BEGIN@13 |
| 1 | 1 | 1 | 361µs | 1.14ms | Moose::BEGIN@41 |
| 1 | 1 | 1 | 315µs | 1.37ms | Moose::BEGIN@46 |
| 1 | 1 | 1 | 197µs | 1.14ms | Moose::BEGIN@31 |
| 1 | 1 | 1 | 196µs | 196µs | Moose::bootstrap (xsub) |
| 1 | 1 | 1 | 187µs | 2.04ms | Moose::BEGIN@17 |
| 18 | 9 | 3 | 171µs | 137ms | Moose::has |
| 4 | 1 | 1 | 116µs | 14.5ms | Moose::init_meta |
| 4 | 3 | 3 | 24µs | 514ms | Moose::with |
| 2 | 2 | 2 | 14µs | 1.08ms | Moose::extends |
| 1 | 1 | 1 | 8µs | 8µs | Moose::BEGIN@11 |
| 1 | 1 | 1 | 7µs | 1.23ms | Moose::BEGIN@43 |
| 1 | 1 | 1 | 7µs | 7µs | Moose::BEGIN@2 |
| 1 | 1 | 1 | 6µs | 39µs | Moose::BEGIN@14 |
| 1 | 1 | 1 | 6µs | 16µs | Moose::BEGIN@8 |
| 1 | 1 | 1 | 5µs | 8µs | Moose::BEGIN@9 |
| 1 | 1 | 1 | 4µs | 4µs | Moose::BEGIN@30 |
| 1 | 1 | 1 | 4µs | 4µs | Moose::BEGIN@20 |
| 1 | 1 | 1 | 3µs | 3µs | Moose::BEGIN@44 |
| 1 | 1 | 1 | 3µs | 3µs | Moose::BEGIN@22 |
| 0 | 0 | 0 | 0s | 0s | Moose::_get_caller |
| 0 | 0 | 0 | 0s | 0s | Moose::after |
| 0 | 0 | 0 | 0s | 0s | Moose::around |
| 0 | 0 | 0 | 0s | 0s | Moose::augment |
| 0 | 0 | 0 | 0s | 0s | Moose::before |
| 0 | 0 | 0 | 0s | 0s | Moose::inner |
| 0 | 0 | 0 | 0s | 0s | Moose::override |
| 0 | 0 | 0 | 0s | 0s | Moose::super |
| 0 | 0 | 0 | 0s | 0s | Moose::throw_error |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose; | ||||
| 2 | # spent 7µs within Moose::BEGIN@2 which was called:
# once (7µs+0s) by Atom::BEGIN@2 at line 4 | ||||
| 3 | 1 | 4µs | $Moose::AUTHORITY = 'cpan:STEVAN'; | ||
| 4 | 1 | 24µs | 1 | 7µs | } # spent 7µs making 1 call to Moose::BEGIN@2 |
| 5 | { | ||||
| 6 | 2 | 900ns | $Moose::VERSION = '2.1005'; | ||
| 7 | } | ||||
| 8 | 2 | 19µs | 2 | 26µs | # spent 16µs (6+10) within Moose::BEGIN@8 which was called:
# once (6µs+10µs) by Atom::BEGIN@2 at line 8 # spent 16µs making 1 call to Moose::BEGIN@8
# spent 10µs making 1 call to strict::import |
| 9 | 2 | 18µs | 2 | 12µs | # spent 8µs (5+3) within Moose::BEGIN@9 which was called:
# once (5µs+3µs) by Atom::BEGIN@2 at line 9 # spent 8µs making 1 call to Moose::BEGIN@9
# spent 3µs making 1 call to warnings::import |
| 10 | |||||
| 11 | 2 | 36µs | 1 | 8µs | # spent 8µs within Moose::BEGIN@11 which was called:
# once (8µs+0s) by Atom::BEGIN@2 at line 11 # spent 8µs making 1 call to Moose::BEGIN@11 |
| 12 | |||||
| 13 | 2 | 98µs | 2 | 798µs | # spent 757µs (499+258) within Moose::BEGIN@13 which was called:
# once (499µs+258µs) by Atom::BEGIN@2 at line 13 # spent 757µs making 1 call to Moose::BEGIN@13
# spent 41µs making 1 call to Exporter::import |
| 14 | 2 | 21µs | 2 | 72µs | # spent 39µs (6+33) within Moose::BEGIN@14 which was called:
# once (6µs+33µs) by Atom::BEGIN@2 at line 14 # spent 39µs making 1 call to Moose::BEGIN@14
# spent 33µs making 1 call to Exporter::import |
| 15 | 2 | 90µs | 2 | 12.6ms | # spent 12.6ms (1.03+11.5) within Moose::BEGIN@15 which was called:
# once (1.03ms+11.5ms) by Atom::BEGIN@2 at line 15 # spent 12.6ms making 1 call to Moose::BEGIN@15
# spent 31µs making 1 call to Exporter::import |
| 16 | |||||
| 17 | 2 | 81µs | 2 | 2.05ms | # spent 2.04ms (187µs+1.86) within Moose::BEGIN@17 which was called:
# once (187µs+1.86ms) by Atom::BEGIN@2 at line 17 # spent 2.04ms making 1 call to Moose::BEGIN@17
# spent 4µs making 1 call to Package::DeprecationManager::__ANON__[Package/DeprecationManager.pm:61] |
| 18 | 2 | 88µs | 2 | 81.8ms | # spent 81.8ms (3.24+78.6) within Moose::BEGIN@18 which was called:
# once (3.24ms+78.6ms) by Atom::BEGIN@2 at line 18 # spent 81.8ms making 1 call to Moose::BEGIN@18
# spent 26µs making 1 call to Moose::Exporter::import |
| 19 | |||||
| 20 | 2 | 37µs | 1 | 4µs | # spent 4µs within Moose::BEGIN@20 which was called:
# once (4µs+0s) by Atom::BEGIN@2 at line 20 # spent 4µs making 1 call to Moose::BEGIN@20 |
| 21 | |||||
| 22 | # spent 3µs within Moose::BEGIN@22 which was called:
# once (3µs+0s) by Atom::BEGIN@2 at line 25 | ||||
| 23 | 1 | 3µs | die "Class::MOP version $Moose::VERSION required--this is version $Class::MOP::VERSION" | ||
| 24 | if $Moose::VERSION && $Class::MOP::VERSION ne $Moose::VERSION; | ||||
| 25 | 1 | 16µs | 1 | 3µs | } # spent 3µs making 1 call to Moose::BEGIN@22 |
| 26 | |||||
| 27 | 2 | 93µs | 1 | 20.1ms | # spent 20.1ms (3.73+16.3) within Moose::BEGIN@27 which was called:
# once (3.73ms+16.3ms) by Atom::BEGIN@2 at line 27 # spent 20.1ms making 1 call to Moose::BEGIN@27 |
| 28 | 2 | 92µs | 1 | 7.27ms | # spent 7.27ms (2.03+5.24) within Moose::BEGIN@28 which was called:
# once (2.03ms+5.24ms) by Atom::BEGIN@2 at line 28 # spent 7.27ms making 1 call to Moose::BEGIN@28 |
| 29 | 2 | 107µs | 1 | 89.2ms | # spent 89.2ms (631µs+88.6) within Moose::BEGIN@29 which was called:
# once (631µs+88.6ms) by Atom::BEGIN@2 at line 29 # spent 89.2ms making 1 call to Moose::BEGIN@29 |
| 30 | 2 | 19µs | 1 | 4µs | # spent 4µs within Moose::BEGIN@30 which was called:
# once (4µs+0s) by Atom::BEGIN@2 at line 30 # spent 4µs making 1 call to Moose::BEGIN@30 |
| 31 | 2 | 99µs | 1 | 1.14ms | # spent 1.14ms (197µs+939µs) within Moose::BEGIN@31 which was called:
# once (197µs+939µs) by Atom::BEGIN@2 at line 31 # spent 1.14ms making 1 call to Moose::BEGIN@31 |
| 32 | |||||
| 33 | 2 | 93µs | 1 | 2.82ms | # spent 2.82ms (817µs+2.00) within Moose::BEGIN@33 which was called:
# once (817µs+2.00ms) by Atom::BEGIN@2 at line 33 # spent 2.82ms making 1 call to Moose::BEGIN@33 |
| 34 | |||||
| 35 | 2 | 92µs | 1 | 18.3ms | # spent 18.3ms (3.04+15.3) within Moose::BEGIN@35 which was called:
# once (3.04ms+15.3ms) by Atom::BEGIN@2 at line 35 # spent 18.3ms making 1 call to Moose::BEGIN@35 |
| 36 | 2 | 92µs | 1 | 2.05ms | # spent 2.05ms (754µs+1.29) within Moose::BEGIN@36 which was called:
# once (754µs+1.29ms) by Atom::BEGIN@2 at line 36 # spent 2.05ms making 1 call to Moose::BEGIN@36 |
| 37 | 2 | 93µs | 1 | 1.51ms | # spent 1.51ms (591µs+922µs) within Moose::BEGIN@37 which was called:
# once (591µs+922µs) by Atom::BEGIN@2 at line 37 # spent 1.51ms making 1 call to Moose::BEGIN@37 |
| 38 | 2 | 97µs | 1 | 2.13ms | # spent 2.13ms (1.39+741µs) within Moose::BEGIN@38 which was called:
# once (1.39ms+741µs) by Atom::BEGIN@2 at line 38 # spent 2.13ms making 1 call to Moose::BEGIN@38 |
| 39 | 2 | 96µs | 1 | 4.90ms | # spent 4.90ms (1.10+3.79) within Moose::BEGIN@39 which was called:
# once (1.10ms+3.79ms) by Atom::BEGIN@2 at line 39 # spent 4.90ms making 1 call to Moose::BEGIN@39 |
| 40 | 2 | 95µs | 1 | 1.26ms | # spent 1.26ms (812µs+445µs) within Moose::BEGIN@40 which was called:
# once (812µs+445µs) by Atom::BEGIN@2 at line 40 # spent 1.26ms making 1 call to Moose::BEGIN@40 |
| 41 | 2 | 91µs | 1 | 1.14ms | # spent 1.14ms (361µs+777µs) within Moose::BEGIN@41 which was called:
# once (361µs+777µs) by Atom::BEGIN@2 at line 41 # spent 1.14ms making 1 call to Moose::BEGIN@41 |
| 42 | |||||
| 43 | 2 | 25µs | 2 | 2.45ms | # spent 1.23ms (7µs+1.22) within Moose::BEGIN@43 which was called:
# once (7µs+1.22ms) by Atom::BEGIN@2 at line 43 # spent 1.23ms making 1 call to Moose::BEGIN@43
# spent 1.22ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519] |
| 44 | 2 | 19µs | 1 | 3µs | # spent 3µs within Moose::BEGIN@44 which was called:
# once (3µs+0s) by Atom::BEGIN@2 at line 44 # spent 3µs making 1 call to Moose::BEGIN@44 |
| 45 | |||||
| 46 | 2 | 918µs | 1 | 1.37ms | # spent 1.37ms (315µs+1.06) within Moose::BEGIN@46 which was called:
# once (315µs+1.06ms) by Atom::BEGIN@2 at line 46 # spent 1.37ms making 1 call to Moose::BEGIN@46 |
| 47 | |||||
| 48 | sub throw_error { | ||||
| 49 | # FIXME This | ||||
| 50 | shift; | ||||
| 51 | goto \&confess | ||||
| 52 | } | ||||
| 53 | |||||
| 54 | # spent 1.08ms (14µs+1.07) within Moose::extends which was called 2 times, avg 542µs/call:
# once (8µs+543µs) by MooseX::Storage::BEGIN@12 at line 10 of MooseX/Storage/Meta/Attribute/DoNotSerialize.pm
# once (5µs+528µs) by Moose::extends at line 409 of Moose/Exporter.pm | ||||
| 55 | 1 | 300ns | my $meta = shift; | ||
| 56 | |||||
| 57 | 1 | 400ns | Moose->throw_error("Must derive at least one class") unless @_; | ||
| 58 | |||||
| 59 | # this checks the metaclass to make sure | ||||
| 60 | # it is correct, sometimes it can get out | ||||
| 61 | # of sync when the classes are being built | ||||
| 62 | 1 | 4µs | 1 | 528µs | $meta->superclasses(@_); # spent 528µs making 1 call to Moose::Meta::Class::superclasses |
| 63 | } | ||||
| 64 | |||||
| 65 | # spent 514ms (24µs+514) within Moose::with which was called 4 times, avg 129ms/call:
# 2 times (10µs+257ms) by Moose::with at line 409 of Moose/Exporter.pm, avg 129ms/call
# once (6µs+246ms) by main::BEGIN@5 at line 7 of lib/HackaMol/Atom.pm
# once (8µs+10.6ms) by MooseX::Storage::BEGIN@12 at line 11 of MooseX/Storage/Meta/Attribute/DoNotSerialize.pm | ||||
| 66 | 2 | 9µs | 2 | 257ms | Moose::Util::apply_all_roles(shift, @_); # spent 257ms making 2 calls to Moose::Util::apply_all_roles, avg 129ms/call |
| 67 | } | ||||
| 68 | |||||
| 69 | # spent 137ms (171µs+137) within Moose::has which was called 18 times, avg 7.61ms/call:
# 9 times (123µs+68.4ms) by Moose::has at line 409 of Moose/Exporter.pm, avg 7.61ms/call
# 2 times (9µs+9.10ms) by main::BEGIN@5 at line 44 of lib/HackaMol/Atom.pm, avg 4.56ms/call
# once (6µs+38.2ms) by main::BEGIN@5 at line 63 of lib/HackaMol/Atom.pm
# once (4µs+6.37ms) by MooseX::Storage::Basic::BEGIN@10 at line 27 of MooseX/Storage/Engine.pm
# once (8µs+6.32ms) by main::BEGIN@5 at line 10 of lib/HackaMol/Atom.pm
# once (4µs+2.68ms) by MooseX::Storage::Basic::BEGIN@10 at line 25 of MooseX/Storage/Engine.pm
# once (4µs+2.54ms) by main::BEGIN@5 at line 24 of lib/HackaMol/Atom.pm
# once (8µs+1.91ms) by MooseX::Storage::Basic::BEGIN@10 at line 19 of MooseX/Storage/Engine.pm
# once (4µs+1.42ms) by MooseX::Storage::Basic::BEGIN@10 at line 28 of MooseX/Storage/Engine.pm | ||||
| 70 | 9 | 1µs | my $meta = shift; | ||
| 71 | 9 | 2µs | my $name = shift; | ||
| 72 | |||||
| 73 | 9 | 4µs | Moose->throw_error('Usage: has \'name\' => ( key => value, ... )') | ||
| 74 | if @_ % 2 == 1; | ||||
| 75 | |||||
| 76 | 9 | 16µs | 9 | 54µs | my %context = Moose::Util::_caller_info; # spent 54µs making 9 calls to Moose::Util::_caller_info, avg 6µs/call |
| 77 | 9 | 4µs | $context{context} = 'has declaration'; | ||
| 78 | 9 | 3µs | $context{type} = 'class'; | ||
| 79 | 9 | 17µs | my %options = ( definition_context => \%context, @_ ); | ||
| 80 | 9 | 7µs | my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; | ||
| 81 | 9 | 49µs | 9 | 68.3ms | $meta->add_attribute( $_, %options ) for @$attrs; # spent 68.3ms making 9 calls to Moose::Meta::Class::add_attribute, avg 7.59ms/call |
| 82 | } | ||||
| 83 | |||||
| 84 | sub before { | ||||
| 85 | Moose::Util::add_method_modifier(shift, 'before', \@_); | ||||
| 86 | } | ||||
| 87 | |||||
| 88 | sub after { | ||||
| 89 | Moose::Util::add_method_modifier(shift, 'after', \@_); | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | sub around { | ||||
| 93 | Moose::Util::add_method_modifier(shift, 'around', \@_); | ||||
| 94 | } | ||||
| 95 | |||||
| 96 | 1 | 0s | our $SUPER_PACKAGE; | ||
| 97 | 1 | 0s | our $SUPER_BODY; | ||
| 98 | 1 | 100ns | our @SUPER_ARGS; | ||
| 99 | |||||
| 100 | sub super { | ||||
| 101 | if (@_) { | ||||
| 102 | carp 'Arguments passed to super() are ignored'; | ||||
| 103 | } | ||||
| 104 | |||||
| 105 | # This check avoids a recursion loop - see | ||||
| 106 | # t/bugs/super_recursion.t | ||||
| 107 | return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller(); | ||||
| 108 | return unless $SUPER_BODY; $SUPER_BODY->(@SUPER_ARGS); | ||||
| 109 | } | ||||
| 110 | |||||
| 111 | sub override { | ||||
| 112 | my $meta = shift; | ||||
| 113 | my ( $name, $method ) = @_; | ||||
| 114 | $meta->add_override_method_modifier( $name => $method ); | ||||
| 115 | } | ||||
| 116 | |||||
| 117 | sub inner { | ||||
| 118 | my $pkg = caller(); | ||||
| 119 | our ( %INNER_BODY, %INNER_ARGS ); | ||||
| 120 | |||||
| 121 | if ( my $body = $INNER_BODY{$pkg} ) { | ||||
| 122 | my @args = @{ $INNER_ARGS{$pkg} }; | ||||
| 123 | local $INNER_ARGS{$pkg}; | ||||
| 124 | local $INNER_BODY{$pkg}; | ||||
| 125 | return $body->(@args); | ||||
| 126 | } else { | ||||
| 127 | return; | ||||
| 128 | } | ||||
| 129 | } | ||||
| 130 | |||||
| 131 | sub augment { | ||||
| 132 | my $meta = shift; | ||||
| 133 | my ( $name, $method ) = @_; | ||||
| 134 | $meta->add_augment_method_modifier( $name => $method ); | ||||
| 135 | } | ||||
| 136 | |||||
| 137 | 1 | 5µs | 1 | 655µs | Moose::Exporter->setup_import_methods( # spent 655µs making 1 call to Moose::Exporter::setup_import_methods |
| 138 | with_meta => [ | ||||
| 139 | qw( extends with has before after around override augment ) | ||||
| 140 | ], | ||||
| 141 | as_is => [ | ||||
| 142 | qw( super inner ), | ||||
| 143 | \&Carp::confess, | ||||
| 144 | \&Scalar::Util::blessed, | ||||
| 145 | ], | ||||
| 146 | ); | ||||
| 147 | |||||
| 148 | # spent 14.5ms (116µs+14.4) within Moose::init_meta which was called 4 times, avg 3.64ms/call:
# 4 times (116µs+14.4ms) by Moose::Exporter::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Exporter.pm:519] at line 474 of Moose/Exporter.pm, avg 3.64ms/call | ||||
| 149 | 4 | 200ns | shift; | ||
| 150 | 4 | 5µs | my %args = @_; | ||
| 151 | |||||
| 152 | 4 | 1µs | my $class = $args{for_class} | ||
| 153 | or Moose->throw_error("Cannot call init_meta without specifying a for_class"); | ||||
| 154 | 4 | 1µs | my $base_class = $args{base_class} || 'Moose::Object'; | ||
| 155 | 4 | 700ns | my $metaclass = $args{metaclass} || 'Moose::Meta::Class'; | ||
| 156 | 4 | 1µs | my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta'; | ||
| 157 | |||||
| 158 | 4 | 14µs | 4 | 6µs | Moose->throw_error("The Metaclass $metaclass must be loaded. (Perhaps you forgot to 'use $metaclass'?)") # spent 6µs making 4 calls to Class::Load::XS::is_class_loaded, avg 2µs/call |
| 159 | unless is_class_loaded($metaclass); | ||||
| 160 | |||||
| 161 | 4 | 11µs | 4 | 4µs | Moose->throw_error("The Metaclass $metaclass must be a subclass of Moose::Meta::Class.") # spent 4µs making 4 calls to UNIVERSAL::isa, avg 925ns/call |
| 162 | unless $metaclass->isa('Moose::Meta::Class'); | ||||
| 163 | |||||
| 164 | # make a subtype for each Moose class | ||||
| 165 | 4 | 8µs | 8 | 1.93ms | class_type($class) # spent 1.89ms making 4 calls to Moose::Util::TypeConstraints::class_type, avg 472µs/call
# spent 46µs making 4 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 11µs/call |
| 166 | unless find_type_constraint($class); | ||||
| 167 | |||||
| 168 | 4 | 300ns | my $meta; | ||
| 169 | |||||
| 170 | 4 | 5µs | 4 | 4µs | if ( $meta = Class::MOP::get_metaclass_by_name($class) ) { # spent 4µs making 4 calls to Class::MOP::get_metaclass_by_name, avg 1µs/call |
| 171 | unless ( $meta->isa("Moose::Meta::Class") ) { | ||||
| 172 | my $error_message = "$class already has a metaclass, but it does not inherit $metaclass ($meta)."; | ||||
| 173 | if ( $meta->isa('Moose::Meta::Role') ) { | ||||
| 174 | Moose->throw_error($error_message . ' You cannot make the same thing a role and a class. Remove either Moose or Moose::Role.'); | ||||
| 175 | } else { | ||||
| 176 | Moose->throw_error($error_message); | ||||
| 177 | } | ||||
| 178 | } | ||||
| 179 | } else { | ||||
| 180 | # no metaclass | ||||
| 181 | |||||
| 182 | # now we check whether our ancestors have metaclass, and if so borrow that | ||||
| 183 | 4 | 17µs | 4 | 9µs | my ( undef, @isa ) = @{ mro::get_linear_isa($class) }; # spent 9µs making 4 calls to mro::get_linear_isa, avg 2µs/call |
| 184 | |||||
| 185 | 4 | 2µs | foreach my $ancestor ( @isa ) { | ||
| 186 | my $ancestor_meta = Class::MOP::get_metaclass_by_name($ancestor) || next; | ||||
| 187 | |||||
| 188 | my $ancestor_meta_class = $ancestor_meta->_real_ref_name; | ||||
| 189 | |||||
| 190 | # if we have an ancestor metaclass that inherits $metaclass, we use | ||||
| 191 | # that. This is like _fix_metaclass_incompatibility, but we can do it now. | ||||
| 192 | |||||
| 193 | # the case of having an ancestry is not very common, but arises in | ||||
| 194 | # e.g. Reaction | ||||
| 195 | unless ( $metaclass->isa( $ancestor_meta_class ) ) { | ||||
| 196 | if ( $ancestor_meta_class->isa($metaclass) ) { | ||||
| 197 | $metaclass = $ancestor_meta_class; | ||||
| 198 | } | ||||
| 199 | } | ||||
| 200 | } | ||||
| 201 | |||||
| 202 | 4 | 6µs | 4 | 5.19ms | $meta = $metaclass->initialize($class); # spent 5.19ms making 4 calls to Moose::Meta::Class::initialize, avg 1.30ms/call |
| 203 | } | ||||
| 204 | |||||
| 205 | 4 | 2µs | if (defined $meta_name) { | ||
| 206 | # also check for inherited non moose 'meta' method? | ||||
| 207 | 4 | 4µs | 4 | 74µs | my $existing = $meta->get_method($meta_name); # spent 74µs making 4 calls to Class::MOP::Mixin::HasMethods::get_method, avg 18µs/call |
| 208 | 4 | 100ns | if ($existing && !$existing->isa('Class::MOP::Method::Meta')) { | ||
| 209 | Carp::cluck "Moose is overwriting an existing method named " | ||||
| 210 | . "$meta_name in class $class with a method " | ||||
| 211 | . "which returns the class's metaclass. If this is " | ||||
| 212 | . "actually what you want, you should remove the " | ||||
| 213 | . "existing method, otherwise, you should rename or " | ||||
| 214 | . "disable this generated method using the " | ||||
| 215 | . "'-meta_name' option to 'use Moose'."; | ||||
| 216 | } | ||||
| 217 | 4 | 4µs | 4 | 4.77ms | $meta->_add_meta_method($meta_name); # spent 4.77ms making 4 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 1.19ms/call |
| 218 | } | ||||
| 219 | |||||
| 220 | # make sure they inherit from Moose::Object | ||||
| 221 | 4 | 8µs | 8 | 2.44ms | $meta->superclasses($base_class) # spent 2.44ms making 8 calls to Moose::Meta::Class::superclasses, avg 305µs/call |
| 222 | unless $meta->superclasses(); | ||||
| 223 | |||||
| 224 | 4 | 11µs | return $meta; | ||
| 225 | } | ||||
| 226 | |||||
| 227 | # This may be used in some older MooseX extensions. | ||||
| 228 | sub _get_caller { | ||||
| 229 | goto &Moose::Exporter::_get_caller; | ||||
| 230 | } | ||||
| 231 | |||||
| 232 | ## make 'em all immutable | ||||
| 233 | |||||
| 234 | 21 | 12µs | 21 | 9µs | $_->make_immutable( # spent 9µs making 21 calls to Class::MOP::Class::is_mutable, avg 433ns/call |
| 235 | inline_constructor => 1, | ||||
| 236 | constructor_name => "_new", | ||||
| 237 | # these are Class::MOP accessors, so they need inlining | ||||
| 238 | inline_accessors => 1 | ||||
| 239 | 22 | 74µs | 42 | 70.6ms | ) for grep { $_->is_mutable } # spent 69.1ms making 21 calls to Class::MOP::Class::make_immutable, avg 3.29ms/call
# spent 1.36ms making 9 calls to Class::MOP::Object::meta, avg 152µs/call
# spent 14µs making 2 calls to Moose::Meta::Role::Method::Required::meta, avg 7µs/call
# spent 10µs making 1 call to Moose::Meta::TypeCoercion::Union::meta
# spent 8µs making 1 call to Moose::Meta::Role::Application::ToRole::meta
# spent 8µs making 1 call to Moose::Meta::Role::meta
# spent 7µs making 1 call to Moose::Meta::TypeCoercion::meta
# spent 7µs making 1 call to Class::MOP::Mixin::meta
# spent 7µs making 1 call to Moose::Meta::Role::Application::ToInstance::meta
# spent 6µs making 1 call to Moose::Meta::Role::Application::ToClass::meta
# spent 6µs making 1 call to Moose::Meta::Role::Application::meta
# spent 6µs making 1 call to Moose::Meta::Role::Application::RoleSummation::meta
# spent 6µs making 1 call to Moose::Meta::Role::Composite::meta |
| 240 | map { $_->meta } | ||||
| 241 | qw( | ||||
| 242 | Moose::Meta::Attribute | ||||
| 243 | Moose::Meta::Class | ||||
| 244 | Moose::Meta::Instance | ||||
| 245 | |||||
| 246 | Moose::Meta::TypeCoercion | ||||
| 247 | Moose::Meta::TypeCoercion::Union | ||||
| 248 | |||||
| 249 | Moose::Meta::Method | ||||
| 250 | Moose::Meta::Method::Constructor | ||||
| 251 | Moose::Meta::Method::Destructor | ||||
| 252 | Moose::Meta::Method::Overridden | ||||
| 253 | Moose::Meta::Method::Augmented | ||||
| 254 | |||||
| 255 | Moose::Meta::Role | ||||
| 256 | Moose::Meta::Role::Attribute | ||||
| 257 | Moose::Meta::Role::Method | ||||
| 258 | Moose::Meta::Role::Method::Required | ||||
| 259 | Moose::Meta::Role::Method::Conflicting | ||||
| 260 | |||||
| 261 | Moose::Meta::Role::Composite | ||||
| 262 | |||||
| 263 | Moose::Meta::Role::Application | ||||
| 264 | Moose::Meta::Role::Application::RoleSummation | ||||
| 265 | Moose::Meta::Role::Application::ToClass | ||||
| 266 | Moose::Meta::Role::Application::ToRole | ||||
| 267 | Moose::Meta::Role::Application::ToInstance | ||||
| 268 | ); | ||||
| 269 | |||||
| 270 | 3 | 2µs | 3 | 2µs | $_->make_immutable( # spent 2µs making 3 calls to Class::MOP::Class::is_mutable, avg 533ns/call |
| 271 | inline_constructor => 0, | ||||
| 272 | constructor_name => undef, | ||||
| 273 | # these are Class::MOP accessors, so they need inlining | ||||
| 274 | inline_accessors => 1 | ||||
| 275 | 4 | 16µs | 6 | 10.3ms | ) for grep { $_->is_mutable } # spent 9.94ms making 3 calls to Class::MOP::Class::make_immutable, avg 3.31ms/call
# spent 376µs making 2 calls to Class::MOP::Object::meta, avg 188µs/call
# spent 9µs making 1 call to Class::MOP::Mixin::meta |
| 276 | map { $_->meta } | ||||
| 277 | qw( | ||||
| 278 | Moose::Meta::Method::Accessor | ||||
| 279 | Moose::Meta::Method::Delegation | ||||
| 280 | Moose::Meta::Mixin::AttributeCore | ||||
| 281 | ); | ||||
| 282 | |||||
| 283 | 1 | 14µs | 1; | ||
| 284 | |||||
| 285 | # ABSTRACT: A postmodern object system for Perl 5 | ||||
| 286 | |||||
| 287 | __END__ | ||||
# spent 196µs within Moose::bootstrap which was called:
# once (196µs+0s) by DynaLoader::bootstrap at line 217 of DynaLoader.pm |