← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:12 2014

Filename/usr/local/lib/perl/5.14.2/Moose.pm
StatementsExecuted 864 statements in 4.05ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.77ms17.5msMoose::::BEGIN@27Moose::BEGIN@27
1113.25ms74.4msMoose::::BEGIN@18Moose::BEGIN@18
1113.12ms15.7msMoose::::BEGIN@35Moose::BEGIN@35
1112.13ms8.30msMoose::::BEGIN@28Moose::BEGIN@28
1111.46ms2.35msMoose::::BEGIN@38Moose::BEGIN@38
1111.15ms2.54msMoose::::BEGIN@39Moose::BEGIN@39
11659121.10ms222msMoose::::hasMoose::has
1111.03ms1.56msMoose::::BEGIN@40Moose::BEGIN@40
111832µs3.19msMoose::::BEGIN@33Moose::BEGIN@33
111816µs2.48msMoose::::BEGIN@36Moose::BEGIN@36
111679µs86.4msMoose::::BEGIN@29Moose::BEGIN@29
111617µs1.79msMoose::::BEGIN@37Moose::BEGIN@37
111413µs1.33msMoose::::BEGIN@41Moose::BEGIN@41
111339µs1.69msMoose::::BEGIN@46Moose::BEGIN@46
1111333µs24.1msMoose::::init_metaMoose::init_meta
111270µs1.43msMoose::::BEGIN@17Moose::BEGIN@17
111201µs1.29msMoose::::BEGIN@31Moose::BEGIN@31
111200µs200µsMoose::::bootstrapMoose::bootstrap (xsub)
43320µs1.07msMoose::::aroundMoose::around
11112µs12µsMoose::::BEGIN@11Moose::BEGIN@11
1118µs1.36msMoose::::BEGIN@43Moose::BEGIN@43
1118µs34µsMoose::::BEGIN@13Moose::BEGIN@13
1117µs28µsMoose::::BEGIN@15Moose::BEGIN@15
1117µs34µsMoose::::BEGIN@14Moose::BEGIN@14
1117µs15µsMoose::::BEGIN@9Moose::BEGIN@9
1116µs6µsMoose::::BEGIN@2Moose::BEGIN@2
1116µs9µsMoose::::BEGIN@8Moose::BEGIN@8
1115µs5µsMoose::::BEGIN@20Moose::BEGIN@20
1115µs5µsMoose::::BEGIN@30Moose::BEGIN@30
1114µs4µsMoose::::BEGIN@44Moose::BEGIN@44
1113µs3µsMoose::::BEGIN@22Moose::BEGIN@22
0000s0sMoose::::_get_callerMoose::_get_caller
0000s0sMoose::::afterMoose::after
0000s0sMoose::::augmentMoose::augment
0000s0sMoose::::beforeMoose::before
0000s0sMoose::::extendsMoose::extends
0000s0sMoose::::innerMoose::inner
0000s0sMoose::::overrideMoose::override
0000s0sMoose::::superMoose::super
0000s0sMoose::::throw_errorMoose::throw_error
0000s0sMoose::::withMoose::with
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose;
2
# spent 6µs within Moose::BEGIN@2 which was called: # once (6µs+0s) by MongoDB::Connection::BEGIN@24 at line 4
BEGIN {
314µs $Moose::AUTHORITY = 'cpan:STEVAN';
4125µs16µs}
# spent 6µs making 1 call to Moose::BEGIN@2
5{
621µs $Moose::VERSION = '2.1005';
7}
8219µs212µs
# spent 9µs (6+3) within Moose::BEGIN@8 which was called: # once (6µs+3µs) by MongoDB::Connection::BEGIN@24 at line 8
use strict;
# spent 9µs making 1 call to Moose::BEGIN@8 # spent 3µs making 1 call to strict::import
9221µs223µs
# spent 15µs (7+8) within Moose::BEGIN@9 which was called: # once (7µs+8µs) by MongoDB::Connection::BEGIN@24 at line 9
use warnings;
# spent 15µs making 1 call to Moose::BEGIN@9 # spent 8µs making 1 call to warnings::import
10
11239µs112µs
# spent 12µs within Moose::BEGIN@11 which was called: # once (12µs+0s) by MongoDB::Connection::BEGIN@24 at line 11
use 5.008;
# spent 12µs making 1 call to Moose::BEGIN@11
12
13226µs260µs
# spent 34µs (8+26) within Moose::BEGIN@13 which was called: # once (8µs+26µs) by MongoDB::Connection::BEGIN@24 at line 13
use Scalar::Util 'blessed';
# spent 34µs making 1 call to Moose::BEGIN@13 # spent 26µs making 1 call to Exporter::import
14223µs260µs
# spent 34µs (7+26) within Moose::BEGIN@14 which was called: # once (7µs+26µs) by MongoDB::Connection::BEGIN@24 at line 14
use Carp 'carp', 'confess';
# spent 34µs making 1 call to Moose::BEGIN@14 # spent 26µs making 1 call to Exporter::import
15222µs249µs
# spent 28µs (7+21) within Moose::BEGIN@15 which was called: # once (7µs+21µs) by MongoDB::Connection::BEGIN@24 at line 15
use Class::Load 'is_class_loaded';
# spent 28µs making 1 call to Moose::BEGIN@15 # spent 21µs making 1 call to Exporter::import
16
17282µs21.43ms
# spent 1.43ms (270µs+1.16) within Moose::BEGIN@17 which was called: # once (270µs+1.16ms) by MongoDB::Connection::BEGIN@24 at line 17
use Moose::Deprecated;
# spent 1.43ms making 1 call to Moose::BEGIN@17 # spent 6µs making 1 call to Package::DeprecationManager::__ANON__[Package/DeprecationManager.pm:61]
18296µs274.4ms
# spent 74.4ms (3.25+71.2) within Moose::BEGIN@18 which was called: # once (3.25ms+71.2ms) by MongoDB::Connection::BEGIN@24 at line 18
use Moose::Exporter;
# spent 74.4ms making 1 call to Moose::BEGIN@18 # spent 18µs making 1 call to Moose::Exporter::import
19
20240µs15µs
# spent 5µs within Moose::BEGIN@20 which was called: # once (5µs+0s) by MongoDB::Connection::BEGIN@24 at line 20
use Class::MOP;
# spent 5µ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 MongoDB::Connection::BEGIN@24 at line 25
BEGIN {
2314µs die "Class::MOP version $Moose::VERSION required--this is version $Class::MOP::VERSION"
24 if $Moose::VERSION && $Class::MOP::VERSION ne $Moose::VERSION;
25117µs13µs}
# spent 3µs making 1 call to Moose::BEGIN@22
26
272101µs117.5ms
# spent 17.5ms (3.77+13.7) within Moose::BEGIN@27 which was called: # once (3.77ms+13.7ms) by MongoDB::Connection::BEGIN@24 at line 27
use Moose::Meta::Class;
# spent 17.5ms making 1 call to Moose::BEGIN@27
282117µs18.30ms
# spent 8.30ms (2.13+6.17) within Moose::BEGIN@28 which was called: # once (2.13ms+6.17ms) by MongoDB::Connection::BEGIN@24 at line 28
use Moose::Meta::TypeConstraint;
# spent 8.30ms making 1 call to Moose::BEGIN@28
292117µs186.4ms
# spent 86.4ms (679µs+85.7) within Moose::BEGIN@29 which was called: # once (679µs+85.7ms) by MongoDB::Connection::BEGIN@24 at line 29
use Moose::Meta::TypeCoercion;
# spent 86.4ms making 1 call to Moose::BEGIN@29
30221µs15µs
# spent 5µs within Moose::BEGIN@30 which was called: # once (5µs+0s) by MongoDB::Connection::BEGIN@24 at line 30
use Moose::Meta::Attribute;
# spent 5µs making 1 call to Moose::BEGIN@30
312105µs11.29ms
# spent 1.29ms (201µs+1.09) within Moose::BEGIN@31 which was called: # once (201µs+1.09ms) by MongoDB::Connection::BEGIN@24 at line 31
use Moose::Meta::Instance;
# spent 1.29ms making 1 call to Moose::BEGIN@31
32
332102µs13.19ms
# spent 3.19ms (832µs+2.36) within Moose::BEGIN@33 which was called: # once (832µs+2.36ms) by MongoDB::Connection::BEGIN@24 at line 33
use Moose::Object;
# spent 3.19ms making 1 call to Moose::BEGIN@33
34
352102µs115.7ms
# spent 15.7ms (3.12+12.6) within Moose::BEGIN@35 which was called: # once (3.12ms+12.6ms) by MongoDB::Connection::BEGIN@24 at line 35
use Moose::Meta::Role;
# spent 15.7ms making 1 call to Moose::BEGIN@35
362124µs12.48ms
# spent 2.48ms (816µs+1.67) within Moose::BEGIN@36 which was called: # once (816µs+1.67ms) by MongoDB::Connection::BEGIN@24 at line 36
use Moose::Meta::Role::Composite;
# spent 2.48ms making 1 call to Moose::BEGIN@36
372104µs11.79ms
# spent 1.79ms (617µs+1.17) within Moose::BEGIN@37 which was called: # once (617µs+1.17ms) by MongoDB::Connection::BEGIN@24 at line 37
use Moose::Meta::Role::Application;
# spent 1.79ms making 1 call to Moose::BEGIN@37
382114µs12.35ms
# spent 2.35ms (1.46+894µs) within Moose::BEGIN@38 which was called: # once (1.46ms+894µs) by MongoDB::Connection::BEGIN@24 at line 38
use Moose::Meta::Role::Application::RoleSummation;
# spent 2.35ms making 1 call to Moose::BEGIN@38
392111µs12.54ms
# spent 2.54ms (1.15+1.39) within Moose::BEGIN@39 which was called: # once (1.15ms+1.39ms) by MongoDB::Connection::BEGIN@24 at line 39
use Moose::Meta::Role::Application::ToClass;
# spent 2.54ms making 1 call to Moose::BEGIN@39
402114µs11.56ms
# spent 1.56ms (1.03+531µs) within Moose::BEGIN@40 which was called: # once (1.03ms+531µs) by MongoDB::Connection::BEGIN@24 at line 40
use Moose::Meta::Role::Application::ToRole;
# spent 1.56ms making 1 call to Moose::BEGIN@40
41292µs11.33ms
# spent 1.33ms (413µs+921µs) within Moose::BEGIN@41 which was called: # once (413µs+921µs) by MongoDB::Connection::BEGIN@24 at line 41
use Moose::Meta::Role::Application::ToInstance;
# spent 1.33ms making 1 call to Moose::BEGIN@41
42
43230µs22.71ms
# spent 1.36ms (8µs+1.35) within Moose::BEGIN@43 which was called: # once (8µs+1.35ms) by MongoDB::Connection::BEGIN@24 at line 43
use Moose::Util::TypeConstraints;
# spent 1.36ms making 1 call to Moose::BEGIN@43 # spent 1.35ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
44221µs14µs
# spent 4µs within Moose::BEGIN@44 which was called: # once (4µs+0s) by MongoDB::Connection::BEGIN@24 at line 44
use Moose::Util ();
# spent 4µs making 1 call to Moose::BEGIN@44
45
462991µs11.69ms
# spent 1.69ms (339µs+1.35) within Moose::BEGIN@46 which was called: # once (339µs+1.35ms) by MongoDB::Connection::BEGIN@24 at line 46
use Moose::Meta::Attribute::Native;
# spent 1.69ms making 1 call to Moose::BEGIN@46
47
48sub throw_error {
49 # FIXME This
50 shift;
51 goto \&confess
52}
53
54sub extends {
55 my $meta = shift;
56
57 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 $meta->superclasses(@_);
63}
64
65sub with {
66 Moose::Util::apply_all_roles(shift, @_);
67}
68
69
# spent 222ms (1.10+221) within Moose::has which was called 116 times, avg 1.91ms/call: # 58 times (800µs+110ms) by Moose::has at line 409 of Moose/Exporter.pm, avg 1.90ms/call # once (5µs+7.95ms) by MongoDB::BEGIN@28 at line 41 of MongoDB/Connection.pm # once (5µs+5.90ms) by MongoDB::Database::BEGIN@26 at line 40 of MongoDB/GridFS.pm # once (5µs+4.13ms) by MongoDB::Database::BEGIN@26 at line 47 of MongoDB/GridFS.pm # once (5µs+3.46ms) by MongoDB::Database::BEGIN@26 at line 60 of MongoDB/GridFS.pm # once (8µs+2.40ms) by MongoDB::Connection::BEGIN@27 at line 38 of MongoDB/Cursor.pm # once (5µs+2.36ms) by MongoDB::Connection::BEGIN@28 at line 43 of MongoDB/MongoClient.pm # once (5µs+2.21ms) by MongoDB::Connection::BEGIN@27 at line 45 of MongoDB/Cursor.pm # once (5µs+2.12ms) by MongoDB::BEGIN@32 at line 48 of MongoDB/DBRef.pm # once (5µs+2.09ms) by MongoDB::BEGIN@32 at line 55 of MongoDB/DBRef.pm # once (5µs+2.07ms) by MongoDB::BEGIN@31 at line 44 of MongoDB/Collection.pm # once (5µs+1.88ms) by MongoDB::Connection::BEGIN@28 at line 115 of MongoDB/MongoClient.pm # once (5µs+1.87ms) by MongoDB::Connection::BEGIN@28 at line 103 of MongoDB/MongoClient.pm # once (5µs+1.87ms) by MongoDB::Connection::BEGIN@28 at line 117 of MongoDB/MongoClient.pm # once (5µs+1.79ms) by MongoDB::Connection::BEGIN@27 at line 125 of MongoDB/Cursor.pm # once (5µs+1.78ms) by MongoDB::Connection::BEGIN@28 at line 168 of MongoDB/MongoClient.pm # once (5µs+1.76ms) by MongoDB::Connection::BEGIN@28 at line 181 of MongoDB/MongoClient.pm # once (5µs+1.74ms) by MongoDB::Connection::BEGIN@28 at line 97 of MongoDB/MongoClient.pm # once (5µs+1.73ms) by MongoDB::Connection::BEGIN@27 at line 67 of MongoDB/Cursor.pm # once (5µs+1.71ms) by MongoDB::Connection::BEGIN@28 at line 91 of MongoDB/MongoClient.pm # once (5µs+1.71ms) by MongoDB::Connection::BEGIN@28 at line 159 of MongoDB/MongoClient.pm # once (5µs+1.70ms) by MongoDB::Connection::BEGIN@27 at line 74 of MongoDB/Cursor.pm # once (5µs+1.70ms) by MongoDB::Connection::BEGIN@28 at line 49 of MongoDB/MongoClient.pm # once (5µs+1.68ms) by MongoDB::Connection::BEGIN@28 at line 55 of MongoDB/MongoClient.pm # once (5µs+1.68ms) by MongoDB::Connection::BEGIN@27 at line 102 of MongoDB/Cursor.pm # once (5µs+1.67ms) by MongoDB::BEGIN@32 at line 68 of MongoDB/DBRef.pm # once (5µs+1.66ms) by MongoDB::Connection::BEGIN@27 at line 119 of MongoDB/Cursor.pm # once (5µs+1.66ms) by MongoDB::Connection::BEGIN@27 at line 81 of MongoDB/Cursor.pm # once (5µs+1.65ms) by MongoDB::Connection::BEGIN@27 at line 93 of MongoDB/Cursor.pm # once (5µs+1.65ms) by MongoDB::Connection::BEGIN@27 at line 110 of MongoDB/Cursor.pm # once (5µs+1.64ms) by MongoDB::BEGIN@32 at line 75 of MongoDB/DBRef.pm # once (5µs+1.61ms) by MongoDB::BEGIN@32 at line 62 of MongoDB/DBRef.pm # once (6µs+1.61ms) by MongoDB::BEGIN@33 at line 27 of MongoDB/OID.pm # once (6µs+1.58ms) by MongoDB::MongoClient::BEGIN@2.14 at line 29 of MongoDB/Timestamp.pm # once (5µs+1.56ms) by MongoDB::Connection::BEGIN@28 at line 139 of MongoDB/MongoClient.pm # once (6µs+1.55ms) by MongoDB::GridFS::BEGIN@26 at line 30 of MongoDB/GridFS/File.pm # once (5µs+1.55ms) by MongoDB::Connection::BEGIN@28 at line 132 of MongoDB/MongoClient.pm # once (5µs+1.54ms) by MongoDB::Connection::BEGIN@28 at line 148 of MongoDB/MongoClient.pm # once (5µs+1.54ms) by MongoDB::Connection::BEGIN@28 at line 124 of MongoDB/MongoClient.pm # once (7µs+1.52ms) by MongoDB::Connection::BEGIN@28 at line 36 of MongoDB/MongoClient.pm # once (6µs+1.52ms) by MongoDB::MongoClient::BEGIN@28 at line 39 of MongoDB/BSON/Binary.pm # once (5µs+1.51ms) by MongoDB::Connection::BEGIN@28 at line 84 of MongoDB/MongoClient.pm # once (6µs+1.50ms) by MongoDB::BEGIN@31 at line 31 of MongoDB/Collection.pm # once (5µs+1.49ms) by MongoDB::Connection::BEGIN@28 at line 77 of MongoDB/MongoClient.pm # once (5µs+1.49ms) by MongoDB::Connection::BEGIN@28 at line 70 of MongoDB/MongoClient.pm # once (5µs+1.48ms) by MongoDB::BEGIN@31 at line 38 of MongoDB/Collection.pm # once (5µs+1.48ms) by MongoDB::MongoClient::BEGIN@28 at line 46 of MongoDB/BSON/Binary.pm # once (6µs+1.48ms) by MongoDB::Database::BEGIN@26 at line 33 of MongoDB/GridFS.pm # once (6µs+1.48ms) by MongoDB::BEGIN@30 at line 29 of MongoDB/Database.pm # once (5µs+1.47ms) by MongoDB::Connection::BEGIN@28 at line 62 of MongoDB/MongoClient.pm # once (5µs+1.46ms) by MongoDB::GridFS::BEGIN@26 at line 37 of MongoDB/GridFS/File.pm # once (5µs+1.45ms) by MongoDB::MongoClient::BEGIN@2.14 at line 36 of MongoDB/Timestamp.pm # once (5µs+1.44ms) by MongoDB::BEGIN@32 at line 43 of MongoDB/DBRef.pm # once (5µs+1.43ms) by MongoDB::Connection::BEGIN@27 at line 51 of MongoDB/Cursor.pm # once (5µs+1.43ms) by MongoDB::BEGIN@30 at line 35 of MongoDB/Database.pm # once (5µs+1.43ms) by MongoDB::Connection::BEGIN@27 at line 57 of MongoDB/Cursor.pm # once (5µs+1.39ms) by MongoDB::Connection::BEGIN@28 at line 175 of MongoDB/MongoClient.pm # once (5µs+1.37ms) by MongoDB::Connection::BEGIN@28 at line 162 of MongoDB/MongoClient.pm # once (5µs+1.30ms) by MongoDB::Connection::BEGIN@27 at line 62 of MongoDB/Cursor.pm
sub has {
70522749µs my $meta = shift;
71 my $name = shift;
72
73 Moose->throw_error('Usage: has \'name\' => ( key => value, ... )')
74 if @_ % 2 == 1;
75
7658431µs my %context = Moose::Util::_caller_info;
# spent 431µs making 58 calls to Moose::Util::_caller_info, avg 7µs/call
77 $context{context} = 'has declaration';
78 $context{type} = 'class';
79 my %options = ( definition_context => \%context, @_ );
80 my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
8158109ms $meta->add_attribute( $_, %options ) for @$attrs;
# spent 109ms making 58 calls to Moose::Meta::Class::add_attribute, avg 1.88ms/call
82}
83
84sub before {
85 Moose::Util::add_method_modifier(shift, 'before', \@_);
86}
87
88sub after {
89 Moose::Util::add_method_modifier(shift, 'after', \@_);
90}
91
92
# spent 1.07ms (20µs+1.05) within Moose::around which was called 4 times, avg 268µs/call: # 2 times (7µs+515µs) by Moose::around at line 409 of Moose/Exporter.pm, avg 261µs/call # once (5µs+283µs) by MongoDB::BEGIN@33 at line 44 of MongoDB/OID.pm # once (7µs+254µs) by MongoDB::BEGIN@28 at line 49 of MongoDB/Connection.pm
sub around {
9327µs2515µs Moose::Util::add_method_modifier(shift, 'around', \@_);
# spent 515µs making 2 calls to Moose::Util::add_method_modifier, avg 258µs/call
94}
95
961200nsour $SUPER_PACKAGE;
971100nsour $SUPER_BODY;
981300nsour @SUPER_ARGS;
99
100sub 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
111sub override {
112 my $meta = shift;
113 my ( $name, $method ) = @_;
114 $meta->add_override_method_modifier( $name => $method );
115}
116
117sub 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
131sub augment {
132 my $meta = shift;
133 my ( $name, $method ) = @_;
134 $meta->add_augment_method_modifier( $name => $method );
135}
136
13716µs1723µsMoose::Exporter->setup_import_methods(
# spent 723µ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 24.1ms (333µs+23.8) within Moose::init_meta which was called 11 times, avg 2.19ms/call: # 11 times (333µs+23.8ms) by Moose::Exporter::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Exporter.pm:519] at line 474 of Moose/Exporter.pm, avg 2.19ms/call
sub init_meta {
149231354µs shift;
150 my %args = @_;
151
152 my $class = $args{for_class}
153 or Moose->throw_error("Cannot call init_meta without specifying a for_class");
154 my $base_class = $args{base_class} || 'Moose::Object';
155 my $metaclass = $args{metaclass} || 'Moose::Meta::Class';
156 my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta';
157
1581121µs Moose->throw_error("The Metaclass $metaclass must be loaded. (Perhaps you forgot to 'use $metaclass'?)")
# spent 21µs making 11 calls to Class::Load::XS::is_class_loaded, avg 2µs/call
159 unless is_class_loaded($metaclass);
160
1611112µs Moose->throw_error("The Metaclass $metaclass must be a subclass of Moose::Meta::Class.")
# spent 12µs making 11 calls to UNIVERSAL::isa, avg 1µs/call
162 unless $metaclass->isa('Moose::Meta::Class');
163
164 # make a subtype for each Moose class
1651900ns225.70ms class_type($class)
# spent 5.56ms making 9 calls to Moose::Util::TypeConstraints::class_type, avg 617µs/call # spent 146µs making 11 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 13µs/call # spent 2µs making 2 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 1µs/call
166 unless find_type_constraint($class);
167
168 my $meta;
169
1701116µs if ( $meta = Class::MOP::get_metaclass_by_name($class) ) {
# spent 16µs making 11 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
1831134µs my ( undef, @isa ) = @{ mro::get_linear_isa($class) };
# spent 34µs making 11 calls to mro::get_linear_isa, avg 3µs/call
184
185 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
202115.71ms $meta = $metaclass->initialize($class);
# spent 5.71ms making 11 calls to Moose::Meta::Class::initialize, avg 519µs/call
203 }
204
205 if (defined $meta_name) {
206 # also check for inherited non moose 'meta' method?
20711251µs my $existing = $meta->get_method($meta_name);
# spent 251µs making 11 calls to Class::MOP::Mixin::HasMethods::get_method, avg 23µs/call
208 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 }
217114.35ms $meta->_add_meta_method($meta_name);
# spent 4.35ms making 11 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 395µs/call
218 }
219
220 # make sure they inherit from Moose::Object
221227.70ms $meta->superclasses($base_class)
# spent 7.70ms making 22 calls to Moose::Meta::Class::superclasses, avg 350µs/call
222 unless $meta->superclasses();
223
224 return $meta;
225}
226
227# This may be used in some older MooseX extensions.
228sub _get_caller {
229 goto &Moose::Exporter::_get_caller;
230}
231
232## make 'em all immutable
233
2342115µs2111µs$_->make_immutable(
# spent 11µs making 21 calls to Class::MOP::Class::is_mutable, avg 524ns/call
235 inline_constructor => 1,
236 constructor_name => "_new",
237 # these are Class::MOP accessors, so they need inlining
238 inline_accessors => 1
2392298µs4259.2ms ) for grep { $_->is_mutable }
# spent 57.5ms making 21 calls to Class::MOP::Class::make_immutable, avg 2.74ms/call # spent 1.59ms making 9 calls to Class::MOP::Object::meta, avg 177µs/call # spent 18µs making 2 calls to Moose::Meta::Role::Method::Required::meta, avg 9µs/call # spent 12µs making 1 call to Moose::Meta::Role::Application::ToClass::meta # spent 11µs making 1 call to Moose::Meta::Role::Application::ToRole::meta # spent 10µs making 1 call to Moose::Meta::TypeCoercion::Union::meta # spent 10µs making 1 call to Moose::Meta::Role::meta # spent 9µs making 1 call to Moose::Meta::TypeCoercion::meta # spent 8µs making 1 call to Moose::Meta::Role::Application::meta # spent 8µs making 1 call to Class::MOP::Mixin::meta # spent 8µs making 1 call to Moose::Meta::Role::Application::ToInstance::meta # spent 8µs making 1 call to Moose::Meta::Role::Application::RoleSummation::meta # spent 8µ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
27033µs32µs$_->make_immutable(
# spent 2µs making 3 calls to Class::MOP::Class::is_mutable, avg 700ns/call
271 inline_constructor => 0,
272 constructor_name => undef,
273 # these are Class::MOP accessors, so they need inlining
274 inline_accessors => 1
275419µs68.04ms ) for grep { $_->is_mutable }
# spent 7.61ms making 3 calls to Class::MOP::Class::make_immutable, avg 2.54ms/call # spent 421µs making 2 calls to Class::MOP::Object::meta, avg 210µs/call # spent 10µ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
283114µs1;
284
285# ABSTRACT: A postmodern object system for Perl 5
286
287__END__
 
# spent 200µs within Moose::bootstrap which was called: # once (200µs+0s) by DynaLoader::bootstrap at line 207 of DynaLoader.pm
sub Moose::bootstrap; # xsub