Filename | /usr/local/lib/perl/5.14.2/Moose.pm |
Statements | Executed 864 statements in 4.05ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 3.77ms | 17.5ms | BEGIN@27 | Moose::
1 | 1 | 1 | 3.25ms | 74.4ms | BEGIN@18 | Moose::
1 | 1 | 1 | 3.12ms | 15.7ms | BEGIN@35 | Moose::
1 | 1 | 1 | 2.13ms | 8.30ms | BEGIN@28 | Moose::
1 | 1 | 1 | 1.46ms | 2.35ms | BEGIN@38 | Moose::
1 | 1 | 1 | 1.15ms | 2.54ms | BEGIN@39 | Moose::
116 | 59 | 12 | 1.10ms | 222ms | has | Moose::
1 | 1 | 1 | 1.03ms | 1.56ms | BEGIN@40 | Moose::
1 | 1 | 1 | 832µs | 3.19ms | BEGIN@33 | Moose::
1 | 1 | 1 | 816µs | 2.48ms | BEGIN@36 | Moose::
1 | 1 | 1 | 679µs | 86.4ms | BEGIN@29 | Moose::
1 | 1 | 1 | 617µs | 1.79ms | BEGIN@37 | Moose::
1 | 1 | 1 | 413µs | 1.33ms | BEGIN@41 | Moose::
1 | 1 | 1 | 339µs | 1.69ms | BEGIN@46 | Moose::
11 | 1 | 1 | 333µs | 24.1ms | init_meta | Moose::
1 | 1 | 1 | 270µs | 1.43ms | BEGIN@17 | Moose::
1 | 1 | 1 | 201µs | 1.29ms | BEGIN@31 | Moose::
1 | 1 | 1 | 200µs | 200µs | bootstrap (xsub) | Moose::
4 | 3 | 3 | 20µs | 1.07ms | around | Moose::
1 | 1 | 1 | 12µs | 12µs | BEGIN@11 | Moose::
1 | 1 | 1 | 8µs | 1.36ms | BEGIN@43 | Moose::
1 | 1 | 1 | 8µs | 34µs | BEGIN@13 | Moose::
1 | 1 | 1 | 7µs | 28µs | BEGIN@15 | Moose::
1 | 1 | 1 | 7µs | 34µs | BEGIN@14 | Moose::
1 | 1 | 1 | 7µs | 15µs | BEGIN@9 | Moose::
1 | 1 | 1 | 6µs | 6µs | BEGIN@2 | Moose::
1 | 1 | 1 | 6µs | 9µs | BEGIN@8 | Moose::
1 | 1 | 1 | 5µs | 5µs | BEGIN@20 | Moose::
1 | 1 | 1 | 5µs | 5µs | BEGIN@30 | Moose::
1 | 1 | 1 | 4µs | 4µs | BEGIN@44 | Moose::
1 | 1 | 1 | 3µs | 3µs | BEGIN@22 | Moose::
0 | 0 | 0 | 0s | 0s | _get_caller | Moose::
0 | 0 | 0 | 0s | 0s | after | Moose::
0 | 0 | 0 | 0s | 0s | augment | Moose::
0 | 0 | 0 | 0s | 0s | before | Moose::
0 | 0 | 0 | 0s | 0s | extends | Moose::
0 | 0 | 0 | 0s | 0s | inner | Moose::
0 | 0 | 0 | 0s | 0s | override | Moose::
0 | 0 | 0 | 0s | 0s | super | Moose::
0 | 0 | 0 | 0s | 0s | throw_error | Moose::
0 | 0 | 0 | 0s | 0s | with | Moose::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Moose; | ||||
2 | # spent 6µs within Moose::BEGIN@2 which was called:
# once (6µs+0s) by MongoDB::Connection::BEGIN@24 at line 4 | ||||
3 | 1 | 4µs | $Moose::AUTHORITY = 'cpan:STEVAN'; | ||
4 | 1 | 25µs | 1 | 6µs | } # spent 6µs making 1 call to Moose::BEGIN@2 |
5 | { | ||||
6 | 2 | 1µs | $Moose::VERSION = '2.1005'; | ||
7 | } | ||||
8 | 2 | 19µs | 2 | 12µ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 # spent 9µs making 1 call to Moose::BEGIN@8
# spent 3µs making 1 call to strict::import |
9 | 2 | 21µs | 2 | 23µ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 # spent 15µs making 1 call to Moose::BEGIN@9
# spent 8µs making 1 call to warnings::import |
10 | |||||
11 | 2 | 39µs | 1 | 12µs | # spent 12µs within Moose::BEGIN@11 which was called:
# once (12µs+0s) by MongoDB::Connection::BEGIN@24 at line 11 # spent 12µs making 1 call to Moose::BEGIN@11 |
12 | |||||
13 | 2 | 26µs | 2 | 60µ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 # spent 34µs making 1 call to Moose::BEGIN@13
# spent 26µs making 1 call to Exporter::import |
14 | 2 | 23µs | 2 | 60µ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 # spent 34µs making 1 call to Moose::BEGIN@14
# spent 26µs making 1 call to Exporter::import |
15 | 2 | 22µs | 2 | 49µ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 # spent 28µs making 1 call to Moose::BEGIN@15
# spent 21µs making 1 call to Exporter::import |
16 | |||||
17 | 2 | 82µs | 2 | 1.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 # spent 1.43ms making 1 call to Moose::BEGIN@17
# spent 6µs making 1 call to Package::DeprecationManager::__ANON__[Package/DeprecationManager.pm:61] |
18 | 2 | 96µs | 2 | 74.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 # spent 74.4ms making 1 call to Moose::BEGIN@18
# spent 18µs making 1 call to Moose::Exporter::import |
19 | |||||
20 | 2 | 40µs | 1 | 5µs | # spent 5µs within Moose::BEGIN@20 which was called:
# once (5µs+0s) by MongoDB::Connection::BEGIN@24 at line 20 # 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 | ||||
23 | 1 | 4µ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 | 17µs | 1 | 3µs | } # spent 3µs making 1 call to Moose::BEGIN@22 |
26 | |||||
27 | 2 | 101µs | 1 | 17.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 # spent 17.5ms making 1 call to Moose::BEGIN@27 |
28 | 2 | 117µs | 1 | 8.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 # spent 8.30ms making 1 call to Moose::BEGIN@28 |
29 | 2 | 117µs | 1 | 86.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 # spent 86.4ms making 1 call to Moose::BEGIN@29 |
30 | 2 | 21µs | 1 | 5µs | # spent 5µs within Moose::BEGIN@30 which was called:
# once (5µs+0s) by MongoDB::Connection::BEGIN@24 at line 30 # spent 5µs making 1 call to Moose::BEGIN@30 |
31 | 2 | 105µs | 1 | 1.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 # spent 1.29ms making 1 call to Moose::BEGIN@31 |
32 | |||||
33 | 2 | 102µs | 1 | 3.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 # spent 3.19ms making 1 call to Moose::BEGIN@33 |
34 | |||||
35 | 2 | 102µs | 1 | 15.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 # spent 15.7ms making 1 call to Moose::BEGIN@35 |
36 | 2 | 124µs | 1 | 2.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 # spent 2.48ms making 1 call to Moose::BEGIN@36 |
37 | 2 | 104µs | 1 | 1.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 # spent 1.79ms making 1 call to Moose::BEGIN@37 |
38 | 2 | 114µs | 1 | 2.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 # spent 2.35ms making 1 call to Moose::BEGIN@38 |
39 | 2 | 111µs | 1 | 2.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 # spent 2.54ms making 1 call to Moose::BEGIN@39 |
40 | 2 | 114µs | 1 | 1.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 # spent 1.56ms making 1 call to Moose::BEGIN@40 |
41 | 2 | 92µs | 1 | 1.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 # spent 1.33ms making 1 call to Moose::BEGIN@41 |
42 | |||||
43 | 2 | 30µs | 2 | 2.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 # spent 1.36ms making 1 call to Moose::BEGIN@43
# spent 1.35ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519] |
44 | 2 | 21µs | 1 | 4µs | # spent 4µs within Moose::BEGIN@44 which was called:
# once (4µs+0s) by MongoDB::Connection::BEGIN@24 at line 44 # spent 4µs making 1 call to Moose::BEGIN@44 |
45 | |||||
46 | 2 | 991µs | 1 | 1.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 # spent 1.69ms making 1 call to Moose::BEGIN@46 |
47 | |||||
48 | sub throw_error { | ||||
49 | # FIXME This | ||||
50 | shift; | ||||
51 | goto \&confess | ||||
52 | } | ||||
53 | |||||
54 | sub 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 | |||||
65 | sub 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 | ||||
70 | 58 | 14µs | my $meta = shift; | ||
71 | 58 | 10µs | my $name = shift; | ||
72 | |||||
73 | 58 | 36µs | Moose->throw_error('Usage: has \'name\' => ( key => value, ... )') | ||
74 | if @_ % 2 == 1; | ||||
75 | |||||
76 | 58 | 133µs | 58 | 431µs | my %context = Moose::Util::_caller_info; # spent 431µs making 58 calls to Moose::Util::_caller_info, avg 7µs/call |
77 | 58 | 30µs | $context{context} = 'has declaration'; | ||
78 | 58 | 21µs | $context{type} = 'class'; | ||
79 | 58 | 98µs | my %options = ( definition_context => \%context, @_ ); | ||
80 | 58 | 56µs | my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; | ||
81 | 58 | 351µs | 58 | 109ms | $meta->add_attribute( $_, %options ) for @$attrs; # spent 109ms making 58 calls to Moose::Meta::Class::add_attribute, avg 1.88ms/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 | # 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 | ||||
93 | 2 | 7µs | 2 | 515µ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 | |||||
96 | 1 | 200ns | our $SUPER_PACKAGE; | ||
97 | 1 | 100ns | our $SUPER_BODY; | ||
98 | 1 | 300ns | 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 | 6µs | 1 | 723µs | Moose::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 | ||||
149 | 11 | 2µs | shift; | ||
150 | 11 | 19µs | my %args = @_; | ||
151 | |||||
152 | 11 | 4µs | my $class = $args{for_class} | ||
153 | or Moose->throw_error("Cannot call init_meta without specifying a for_class"); | ||||
154 | 11 | 4µs | my $base_class = $args{base_class} || 'Moose::Object'; | ||
155 | 11 | 3µs | my $metaclass = $args{metaclass} || 'Moose::Meta::Class'; | ||
156 | 11 | 5µs | my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta'; | ||
157 | |||||
158 | 11 | 42µs | 11 | 21µ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 | |||||
161 | 11 | 34µs | 11 | 12µ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 | ||||
165 | 11 | 26µs | 22 | 5.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 | 11 | 2µs | my $meta; | ||
169 | |||||
170 | 11 | 18µs | 11 | 16µ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 | ||||
183 | 22 | 62µs | 11 | 34µ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 | 11 | 10µ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 | 11 | 18µs | 11 | 5.71ms | $meta = $metaclass->initialize($class); # spent 5.71ms making 11 calls to Moose::Meta::Class::initialize, avg 519µs/call |
203 | } | ||||
204 | |||||
205 | 11 | 9µs | if (defined $meta_name) { | ||
206 | # also check for inherited non moose 'meta' method? | ||||
207 | 11 | 15µs | 11 | 251µ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 | 11 | 2µs | 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 | 11 | 14µs | 11 | 4.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 | ||||
221 | 11 | 35µs | 22 | 7.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 | 11 | 32µ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 | 15µs | 21 | 11µ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 | ||||
239 | 22 | 98µs | 42 | 59.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 | |||||
270 | 3 | 3µs | 3 | 2µ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 | ||||
275 | 4 | 19µs | 6 | 8.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 | |||||
283 | 1 | 14µs | 1; | ||
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 |