← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 10:04:38 2014
Reported on Tue Jun 24 10:05:06 2014

Filename/usr/local/lib/perl/5.14.2/Moose.pm
StatementsExecuted 864 statements in 4.31ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.92ms18.1msMoose::::BEGIN@27Moose::BEGIN@27
1113.37ms76.3msMoose::::BEGIN@18Moose::BEGIN@18
1113.14ms16.0msMoose::::BEGIN@35Moose::BEGIN@35
1112.20ms8.57msMoose::::BEGIN@28Moose::BEGIN@28
1111.50ms2.41msMoose::::BEGIN@38Moose::BEGIN@38
1111.20ms2.71msMoose::::BEGIN@39Moose::BEGIN@39
11659121.13ms219msMoose::::hasMoose::has
1111.12ms1.66msMoose::::BEGIN@40Moose::BEGIN@40
111840µs3.30msMoose::::BEGIN@33Moose::BEGIN@33
111835µs2.46msMoose::::BEGIN@36Moose::BEGIN@36
111686µs88.2msMoose::::BEGIN@29Moose::BEGIN@29
111621µs1.75msMoose::::BEGIN@37Moose::BEGIN@37
111393µs1.30msMoose::::BEGIN@41Moose::BEGIN@41
111367µs1.70msMoose::::BEGIN@46Moose::BEGIN@46
1111350µs25.2msMoose::::init_metaMoose::init_meta
111289µs1.58msMoose::::BEGIN@17Moose::BEGIN@17
111231µs1.34msMoose::::BEGIN@31Moose::BEGIN@31
111212µs212µsMoose::::bootstrapMoose::bootstrap (xsub)
43323µs1.11msMoose::::aroundMoose::around
11112µs12µsMoose::::BEGIN@11Moose::BEGIN@11
1118µs30µsMoose::::BEGIN@15Moose::BEGIN@15
1118µs35µsMoose::::BEGIN@13Moose::BEGIN@13
1118µs8µsMoose::::BEGIN@2Moose::BEGIN@2
1117µs35µsMoose::::BEGIN@14Moose::BEGIN@14
1117µs1.41msMoose::::BEGIN@43Moose::BEGIN@43
1117µs16µsMoose::::BEGIN@9Moose::BEGIN@9
1116µs9µsMoose::::BEGIN@8Moose::BEGIN@8
1115µs5µsMoose::::BEGIN@30Moose::BEGIN@30
1115µs5µsMoose::::BEGIN@20Moose::BEGIN@20
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 8µs within Moose::BEGIN@2 which was called: # once (8µs+0s) by MongoDB::Connection::BEGIN@24 at line 4
BEGIN {
315µs $Moose::AUTHORITY = 'cpan:STEVAN';
4126µs18µs}
# spent 8µs making 1 call to Moose::BEGIN@2
5{
621µs $Moose::VERSION = '2.1005';
7}
8220µ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
9222µs225µs
# spent 16µs (7+9) within Moose::BEGIN@9 which was called: # once (7µs+9µs) by MongoDB::Connection::BEGIN@24 at line 9
use warnings;
# spent 16µs making 1 call to Moose::BEGIN@9 # spent 9µ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
13227µs262µs
# spent 35µs (8+27) within Moose::BEGIN@13 which was called: # once (8µs+27µs) by MongoDB::Connection::BEGIN@24 at line 13
use Scalar::Util 'blessed';
# spent 35µs making 1 call to Moose::BEGIN@13 # spent 27µs making 1 call to Exporter::import
14223µs262µs
# spent 35µs (7+28) within Moose::BEGIN@14 which was called: # once (7µs+28µs) by MongoDB::Connection::BEGIN@24 at line 14
use Carp 'carp', 'confess';
# spent 35µs making 1 call to Moose::BEGIN@14 # spent 27µs making 1 call to Exporter::import
15223µs253µs
# spent 30µs (8+22) within Moose::BEGIN@15 which was called: # once (8µs+22µs) by MongoDB::Connection::BEGIN@24 at line 15
use Class::Load 'is_class_loaded';
# spent 30µs making 1 call to Moose::BEGIN@15 # spent 22µs making 1 call to Exporter::import
16
17288µs21.58ms
# spent 1.58ms (289µs+1.29) within Moose::BEGIN@17 which was called: # once (289µs+1.29ms) by MongoDB::Connection::BEGIN@24 at line 17
use Moose::Deprecated;
# spent 1.58ms making 1 call to Moose::BEGIN@17 # spent 6µs making 1 call to Package::DeprecationManager::__ANON__[Package/DeprecationManager.pm:61]
18296µs276.3ms
# spent 76.3ms (3.37+72.9) within Moose::BEGIN@18 which was called: # once (3.37ms+72.9ms) by MongoDB::Connection::BEGIN@24 at line 18
use Moose::Exporter;
# spent 76.3ms making 1 call to Moose::BEGIN@18 # spent 19µ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;
25118µs13µs}
# spent 3µs making 1 call to Moose::BEGIN@22
26
272128µs118.1ms
# spent 18.1ms (3.92+14.1) within Moose::BEGIN@27 which was called: # once (3.92ms+14.1ms) by MongoDB::Connection::BEGIN@24 at line 27
use Moose::Meta::Class;
# spent 18.1ms making 1 call to Moose::BEGIN@27
282121µs18.57ms
# spent 8.57ms (2.20+6.37) within Moose::BEGIN@28 which was called: # once (2.20ms+6.37ms) by MongoDB::Connection::BEGIN@24 at line 28
use Moose::Meta::TypeConstraint;
# spent 8.57ms making 1 call to Moose::BEGIN@28
292123µs188.2ms
# spent 88.2ms (686µs+87.5) within Moose::BEGIN@29 which was called: # once (686µs+87.5ms) by MongoDB::Connection::BEGIN@24 at line 29
use Moose::Meta::TypeCoercion;
# spent 88.2ms 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
312136µs11.34ms
# spent 1.34ms (231µs+1.11) within Moose::BEGIN@31 which was called: # once (231µs+1.11ms) by MongoDB::Connection::BEGIN@24 at line 31
use Moose::Meta::Instance;
# spent 1.34ms making 1 call to Moose::BEGIN@31
32
332103µs13.30ms
# spent 3.30ms (840µs+2.46) within Moose::BEGIN@33 which was called: # once (840µs+2.46ms) by MongoDB::Connection::BEGIN@24 at line 33
use Moose::Object;
# spent 3.30ms making 1 call to Moose::BEGIN@33
34
352116µs116.0ms
# spent 16.0ms (3.14+12.9) within Moose::BEGIN@35 which was called: # once (3.14ms+12.9ms) by MongoDB::Connection::BEGIN@24 at line 35
use Moose::Meta::Role;
# spent 16.0ms making 1 call to Moose::BEGIN@35
362124µs12.46ms
# spent 2.46ms (835µs+1.63) within Moose::BEGIN@36 which was called: # once (835µs+1.63ms) by MongoDB::Connection::BEGIN@24 at line 36
use Moose::Meta::Role::Composite;
# spent 2.46ms making 1 call to Moose::BEGIN@36
372109µs11.75ms
# spent 1.75ms (621µs+1.13) within Moose::BEGIN@37 which was called: # once (621µs+1.13ms) by MongoDB::Connection::BEGIN@24 at line 37
use Moose::Meta::Role::Application;
# spent 1.75ms making 1 call to Moose::BEGIN@37
382122µs12.41ms
# spent 2.41ms (1.50+906µs) within Moose::BEGIN@38 which was called: # once (1.50ms+906µs) by MongoDB::Connection::BEGIN@24 at line 38
use Moose::Meta::Role::Application::RoleSummation;
# spent 2.41ms making 1 call to Moose::BEGIN@38
392116µs12.71ms
# spent 2.71ms (1.20+1.51) within Moose::BEGIN@39 which was called: # once (1.20ms+1.51ms) by MongoDB::Connection::BEGIN@24 at line 39
use Moose::Meta::Role::Application::ToClass;
# spent 2.71ms making 1 call to Moose::BEGIN@39
402130µs11.66ms
# spent 1.66ms (1.12+537µs) within Moose::BEGIN@40 which was called: # once (1.12ms+537µs) by MongoDB::Connection::BEGIN@24 at line 40
use Moose::Meta::Role::Application::ToRole;
# spent 1.66ms making 1 call to Moose::BEGIN@40
412103µs11.30ms
# spent 1.30ms (393µs+909µs) within Moose::BEGIN@41 which was called: # once (393µs+909µs) by MongoDB::Connection::BEGIN@24 at line 41
use Moose::Meta::Role::Application::ToInstance;
# spent 1.30ms making 1 call to Moose::BEGIN@41
42
43230µs22.80ms
# spent 1.41ms (7µs+1.40) within Moose::BEGIN@43 which was called: # once (7µs+1.40ms) by MongoDB::Connection::BEGIN@24 at line 43
use Moose::Util::TypeConstraints;
# spent 1.41ms making 1 call to Moose::BEGIN@43 # spent 1.40ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
44220µ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
4621.06ms11.70ms
# spent 1.70ms (367µs+1.33) within Moose::BEGIN@46 which was called: # once (367µs+1.33ms) by MongoDB::Connection::BEGIN@24 at line 46
use Moose::Meta::Attribute::Native;
# spent 1.70ms 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 219ms (1.13+218) within Moose::has which was called 116 times, avg 1.89ms/call: # 58 times (828µs+108ms) by Moose::has at line 409 of Moose/Exporter.pm, avg 1.88ms/call # once (5µs+8.19ms) by MongoDB::BEGIN@28 at line 41 of MongoDB/Connection.pm # once (5µs+4.27ms) by MongoDB::Database::BEGIN@26 at line 47 of MongoDB/GridFS.pm # once (5µs+3.58ms) by MongoDB::Database::BEGIN@26 at line 60 of MongoDB/GridFS.pm # once (8µs+2.54ms) by MongoDB::Connection::BEGIN@27 at line 38 of MongoDB/Cursor.pm # once (5µs+2.44ms) by MongoDB::Connection::BEGIN@28 at line 43 of MongoDB/MongoClient.pm # once (5µs+2.33ms) by MongoDB::Connection::BEGIN@27 at line 45 of MongoDB/Cursor.pm # once (5µs+2.14ms) by MongoDB::BEGIN@32 at line 48 of MongoDB/DBRef.pm # once (5µs+2.07ms) 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.92ms) by MongoDB::Connection::BEGIN@28 at line 115 of MongoDB/MongoClient.pm # once (5µs+1.88ms) 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.81ms) by MongoDB::Connection::BEGIN@28 at line 168 of MongoDB/MongoClient.pm # once (5µs+1.80ms) by MongoDB::Connection::BEGIN@27 at line 119 of MongoDB/Cursor.pm # once (5µs+1.79ms) by MongoDB::Connection::BEGIN@28 at line 55 of MongoDB/MongoClient.pm # once (5µs+1.79ms) by MongoDB::Connection::BEGIN@28 at line 97 of MongoDB/MongoClient.pm # once (5µs+1.77ms) by MongoDB::Connection::BEGIN@28 at line 91 of MongoDB/MongoClient.pm # once (5µs+1.77ms) by MongoDB::Connection::BEGIN@27 at line 125 of MongoDB/Cursor.pm # once (5µs+1.76ms) by MongoDB::Connection::BEGIN@27 at line 67 of MongoDB/Cursor.pm # once (5µs+1.75ms) by MongoDB::Connection::BEGIN@28 at line 148 of MongoDB/MongoClient.pm # once (7µs+1.74ms) by MongoDB::MongoClient::BEGIN@2.14 at line 29 of MongoDB/Timestamp.pm # once (5µs+1.74ms) by MongoDB::Connection::BEGIN@28 at line 181 of MongoDB/MongoClient.pm # once (5µs+1.74ms) by MongoDB::Connection::BEGIN@27 at line 74 of MongoDB/Cursor.pm # once (5µs+1.73ms) by MongoDB::Connection::BEGIN@28 at line 49 of MongoDB/MongoClient.pm # once (5µs+1.73ms) by MongoDB::Connection::BEGIN@27 at line 102 of MongoDB/Cursor.pm # once (6µs+1.72ms) by MongoDB::BEGIN@33 at line 27 of MongoDB/OID.pm # once (5µs+1.71ms) by MongoDB::Connection::BEGIN@27 at line 110 of MongoDB/Cursor.pm # once (5µs+1.71ms) by MongoDB::Connection::BEGIN@28 at line 159 of MongoDB/MongoClient.pm # once (5µs+1.69ms) by MongoDB::Connection::BEGIN@27 at line 93 of MongoDB/Cursor.pm # once (5µs+1.69ms) by MongoDB::Connection::BEGIN@27 at line 81 of MongoDB/Cursor.pm # once (5µs+1.67ms) by MongoDB::BEGIN@32 at line 75 of MongoDB/DBRef.pm # once (5µs+1.66ms) by MongoDB::BEGIN@32 at line 62 of MongoDB/DBRef.pm # once (5µs+1.64ms) by MongoDB::BEGIN@32 at line 68 of MongoDB/DBRef.pm # once (7µs+1.63ms) by MongoDB::GridFS::BEGIN@26 at line 30 of MongoDB/GridFS/File.pm # once (6µs+1.62ms) by MongoDB::MongoClient::BEGIN@28 at line 39 of MongoDB/BSON/Binary.pm # once (5µs+1.61ms) by MongoDB::Connection::BEGIN@28 at line 139 of MongoDB/MongoClient.pm # once (5µs+1.61ms) by MongoDB::Connection::BEGIN@28 at line 124 of MongoDB/MongoClient.pm # once (5µs+1.59ms) by MongoDB::Connection::BEGIN@28 at line 77 of MongoDB/MongoClient.pm # once (5µs+1.56ms) by MongoDB::Connection::BEGIN@28 at line 132 of MongoDB/MongoClient.pm # once (5µs+1.55ms) by MongoDB::MongoClient::BEGIN@28 at line 46 of MongoDB/BSON/Binary.pm # once (5µs+1.55ms) by MongoDB::Connection::BEGIN@28 at line 84 of MongoDB/MongoClient.pm # once (7µs+1.55ms) by MongoDB::Connection::BEGIN@28 at line 36 of MongoDB/MongoClient.pm # once (7µs+1.54ms) by MongoDB::BEGIN@31 at line 31 of MongoDB/Collection.pm # once (5µs+1.53ms) by MongoDB::Connection::BEGIN@27 at line 51 of MongoDB/Cursor.pm # once (5µs+1.53ms) by MongoDB::GridFS::BEGIN@26 at line 37 of MongoDB/GridFS/File.pm # once (5µs+1.52ms) by MongoDB::MongoClient::BEGIN@2.14 at line 36 of MongoDB/Timestamp.pm # once (5µs+1.51ms) by MongoDB::Connection::BEGIN@28 at line 62 of MongoDB/MongoClient.pm # once (5µs+1.51ms) by MongoDB::BEGIN@32 at line 43 of MongoDB/DBRef.pm # once (5µs+1.50ms) by MongoDB::BEGIN@31 at line 38 of MongoDB/Collection.pm # once (5µs+1.50ms) by MongoDB::Database::BEGIN@26 at line 40 of MongoDB/GridFS.pm # once (6µs+1.49ms) by MongoDB::Database::BEGIN@26 at line 33 of MongoDB/GridFS.pm # once (5µs+1.48ms) by MongoDB::Connection::BEGIN@28 at line 70 of MongoDB/MongoClient.pm # once (6µs+1.48ms) by MongoDB::BEGIN@30 at line 29 of MongoDB/Database.pm # once (5µs+1.44ms) by MongoDB::BEGIN@30 at line 35 of MongoDB/Database.pm # once (5µs+1.43ms) by MongoDB::Connection::BEGIN@28 at line 175 of MongoDB/MongoClient.pm # once (5µs+1.42ms) by MongoDB::Connection::BEGIN@27 at line 57 of MongoDB/Cursor.pm # once (5µs+1.40ms) by MongoDB::Connection::BEGIN@28 at line 162 of MongoDB/MongoClient.pm # once (5µs+1.33ms) by MongoDB::Connection::BEGIN@27 at line 62 of MongoDB/Cursor.pm
sub has {
70522769µs my $meta = shift;
71 my $name = shift;
72
73 Moose->throw_error('Usage: has \'name\' => ( key => value, ... )')
74 if @_ % 2 == 1;
75
7658438µs my %context = Moose::Util::_caller_info;
# spent 438µs making 58 calls to Moose::Util::_caller_info, avg 8µ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) ];
8158108ms $meta->add_attribute( $_, %options ) for @$attrs;
# spent 108ms making 58 calls to Moose::Meta::Class::add_attribute, avg 1.86ms/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.11ms (23µs+1.08) within Moose::around which was called 4 times, avg 276µs/call: # 2 times (9µs+529µs) by Moose::around at line 409 of Moose/Exporter.pm, avg 269µs/call # once (6µs+295µs) by MongoDB::BEGIN@33 at line 44 of MongoDB/OID.pm # once (8µs+259µs) by MongoDB::BEGIN@28 at line 49 of MongoDB/Connection.pm
sub around {
9329µs2529µs Moose::Util::add_method_modifier(shift, 'around', \@_);
# spent 529µs making 2 calls to Moose::Util::add_method_modifier, avg 265µs/call
94}
95
961100nsour $SUPER_PACKAGE;
971100nsour $SUPER_BODY;
981200nsour @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
13717µs1772µsMoose::Exporter->setup_import_methods(
# spent 772µ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 25.2ms (350µs+24.8) within Moose::init_meta which was called 11 times, avg 2.29ms/call: # 11 times (350µs+24.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.29ms/call
sub init_meta {
149231371µ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
1581122µs Moose->throw_error("The Metaclass $metaclass must be loaded. (Perhaps you forgot to 'use $metaclass'?)")
# spent 22µ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
16511µs226.29ms class_type($class)
# spent 6.14ms making 9 calls to Moose::Util::TypeConstraints::class_type, avg 682µs/call # spent 151µs making 11 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 14µs/call # spent 3µ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.93ms $meta = $metaclass->initialize($class);
# spent 5.93ms making 11 calls to Moose::Meta::Class::initialize, avg 540µs/call
203 }
204
205 if (defined $meta_name) {
206 # also check for inherited non moose 'meta' method?
20711256µs my $existing = $meta->get_method($meta_name);
# spent 256µ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.48ms $meta->_add_meta_method($meta_name);
# spent 4.48ms making 11 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 408µs/call
218 }
219
220 # make sure they inherit from Moose::Object
221227.77ms $meta->superclasses($base_class)
# spent 7.77ms making 22 calls to Moose::Meta::Class::superclasses, avg 353µ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
2342117µs2112µs$_->make_immutable(
# spent 12µs making 21 calls to Class::MOP::Class::is_mutable, avg 571ns/call
235 inline_constructor => 1,
236 constructor_name => "_new",
237 # these are Class::MOP accessors, so they need inlining
238 inline_accessors => 1
23922109µs4260.3ms ) for grep { $_->is_mutable }
# spent 58.6ms making 21 calls to Class::MOP::Class::make_immutable, avg 2.79ms/call # spent 1.60ms making 9 calls to Class::MOP::Object::meta, avg 178µs/call # spent 18µs making 2 calls to Moose::Meta::Role::Method::Required::meta, avg 9µs/call # spent 14µs making 1 call to Moose::Meta::Role::Application::ToClass::meta # spent 11µs making 1 call to Moose::Meta::Role::Application::RoleSummation::meta # spent 11µs making 1 call to Moose::Meta::Role::Application::ToRole::meta # spent 11µ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::Role::Application::ToInstance::meta # spent 9µs making 1 call to Moose::Meta::TypeCoercion::meta # spent 8µs making 1 call to Class::MOP::Mixin::meta # spent 8µs making 1 call to Moose::Meta::Role::Application::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 633ns/call
271 inline_constructor => 0,
272 constructor_name => undef,
273 # these are Class::MOP accessors, so they need inlining
274 inline_accessors => 1
275420µs68.38ms ) for grep { $_->is_mutable }
# spent 7.93ms making 3 calls to Class::MOP::Class::make_immutable, avg 2.64ms/call # spent 430µs making 2 calls to Class::MOP::Object::meta, avg 215µs/call # spent 11µ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 212µs within Moose::bootstrap which was called: # once (212µs+0s) by DynaLoader::bootstrap at line 207 of DynaLoader.pm
sub Moose::bootstrap; # xsub