← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:39:01 2010
Reported on Wed Nov 17 22:07:19 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm
StatementsExecuted 25903 statements in 261ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1001162.8ms539msMoose::Exporter::::__ANON__[:125]Moose::Exporter::__ANON__[:125]
7521141.8ms81.2msMoose::Exporter::::__ANON__[:329]Moose::Exporter::__ANON__[:329]
481133.0ms33.7msMoose::Exporter::::_remove_keywordsMoose::Exporter::_remove_keywords
7521129.1ms29.1msMoose::Exporter::::_late_curry_wrapperMoose::Exporter::_late_curry_wrapper
1001009623.9ms1.73sMoose::Exporter::::__ANON__[:456]Moose::Exporter::__ANON__[:456]
11120.3ms417msMoose::Exporter::::BEGIN@11Moose::Exporter::BEGIN@11
616115.36ms5.36msMoose::Exporter::::__ANON__[:259]Moose::Exporter::__ANON__[:259]
216114.97ms12.8msMoose::Exporter::::__ANON__[:321]Moose::Exporter::__ANON__[:321]
100114.45ms6.34msMoose::Exporter::::_strip_traitsMoose::Exporter::_strip_traits
1113.61ms4.61msMoose::Exporter::::BEGIN@13Moose::Exporter::BEGIN@13
100113.28ms4.43msMoose::Exporter::::_strip_metaclassMoose::Exporter::_strip_metaclass
100113.24ms4.37msMoose::Exporter::::_strip_meta_nameMoose::Exporter::_strip_meta_name
4848472.31ms36.0msMoose::Exporter::::__ANON__[:557]Moose::Exporter::__ANON__[:557]
3111.98ms3.58msMoose::Exporter::::_make_sub_exporter_paramsMoose::Exporter::_make_sub_exporter_params
100111.60ms1.60msMoose::Exporter::::_get_callerMoose::Exporter::_get_caller
186111.36ms1.36msMoose::Exporter::::_flag_as_reexportMoose::Exporter::_flag_as_reexport (xsub)
39211.05ms1.05msMoose::Exporter::::_sub_from_packageMoose::Exporter::_sub_from_package
311828µs15.2msMoose::Exporter::::build_import_methodsMoose::Exporter::build_import_methods
9411621µs621µsMoose::Exporter::::_export_is_flaggedMoose::Exporter::_export_is_flagged (xsub)
1611437µs437µsMoose::Exporter::::_make_wrapped_sub_with_metaMoose::Exporter::_make_wrapped_sub_with_meta
311269µs269µsMoose::Exporter::::_make_init_metaMoose::Exporter::_make_init_meta
311182µs293µsMoose::Exporter::::_follow_alsoMoose::Exporter::_follow_also
333178µs15.4msMoose::Exporter::::setup_import_methodsMoose::Exporter::setup_import_methods
311172µs7.26msMoose::Exporter::::_make_exporterMoose::Exporter::_make_exporter
333133µs393µsMoose::Exporter::::importMoose::Exporter::import
311124µs124µsMoose::Exporter::::_make_import_subMoose::Exporter::_make_import_sub
111114µs141µsMoose::Exporter::::BEGIN@3Moose::Exporter::BEGIN@3
31186µs86µsMoose::Exporter::::_make_unimport_subMoose::Exporter::_make_unimport_sub
31180µs80µsMoose::Exporter::::_parse_trait_aliasesMoose::Exporter::_parse_trait_aliases
11169µs786µsMoose::Exporter::::BEGIN@15Moose::Exporter::BEGIN@15
11164µs163µsMoose::Exporter::::BEGIN@4Moose::Exporter::BEGIN@4
31162µs62µsMoose::Exporter::::_follow_also_realMoose::Exporter::_follow_also_real
11144µs270µsMoose::Exporter::::BEGIN@12Moose::Exporter::BEGIN@12
11144µs119µsMoose::Exporter::::BEGIN@272Moose::Exporter::BEGIN@272
11144µs210µsMoose::Exporter::::BEGIN@14Moose::Exporter::BEGIN@14
11143µs119µsMoose::Exporter::::BEGIN@567Moose::Exporter::BEGIN@567
11142µs113µsMoose::Exporter::::BEGIN@120Moose::Exporter::BEGIN@120
11141µs200µsMoose::Exporter::::BEGIN@16Moose::Exporter::BEGIN@16
11139µs104µsMoose::Exporter::::BEGIN@121Moose::Exporter::BEGIN@121
11138µs99µsMoose::Exporter::::BEGIN@577Moose::Exporter::BEGIN@577
11124µs24µsMoose::Exporter::::BEGIN@18Moose::Exporter::BEGIN@18
0000s0sMoose::Exporter::::__ANON__[:189]Moose::Exporter::__ANON__[:189]
0000s0sMoose::Exporter::::__ANON__[:307]Moose::Exporter::__ANON__[:307]
0000s0sMoose::Exporter::::__ANON__[:338]Moose::Exporter::__ANON__[:338]
0000s0sMoose::Exporter::::__ANON__[:360]Moose::Exporter::__ANON__[:360]
0000s0sMoose::Exporter::::__ANON__[:460]Moose::Exporter::__ANON__[:460]
0000s0sMoose::Exporter::::__ANON__[:474]Moose::Exporter::__ANON__[:474]
0000s0sMoose::Exporter::::__ANON__[:486]Moose::Exporter::__ANON__[:486]
0000s0sMoose::Exporter::::__ANON__[:643]Moose::Exporter::__ANON__[:643]
0000s0sMoose::Exporter::::_apply_meta_traitsMoose::Exporter::_apply_meta_traits
0000s0sMoose::Exporter::::_curry_wrapperMoose::Exporter::_curry_wrapper
0000s0sMoose::Exporter::::_make_wrapped_subMoose::Exporter::_make_wrapped_sub
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Exporter;
2
33167µs2168µs
# spent 141µs (114+27) within Moose::Exporter::BEGIN@3 which was called: # once (114µs+27µs) by Moose::BEGIN@15 at line 3
use strict;
# spent 141µs making 1 call to Moose::Exporter::BEGIN@3 # spent 27µs making 1 call to strict::import
43369µs2261µs
# spent 163µs (64+98) within Moose::Exporter::BEGIN@4 which was called: # once (64µs+98µs) by Moose::BEGIN@15 at line 4
use warnings;
# spent 163µs making 1 call to Moose::Exporter::BEGIN@4 # spent 98µs making 1 call to warnings::import
5
614µsour $VERSION = '1.19';
713µsour $XS_VERSION = $VERSION;
8169µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
913µsour $AUTHORITY = 'cpan:STEVAN';
10
113744µs1417ms
# spent 417ms (20.3+397) within Moose::Exporter::BEGIN@11 which was called: # once (20.3ms+397ms) by Moose::BEGIN@15 at line 11
use Class::MOP;
# spent 417ms making 1 call to Moose::Exporter::BEGIN@11
123119µs2496µs
# spent 270µs (44+226) within Moose::Exporter::BEGIN@12 which was called: # once (44µs+226µs) by Moose::BEGIN@15 at line 12
use List::MoreUtils qw( first_index uniq );
# spent 270µs making 1 call to Moose::Exporter::BEGIN@12 # spent 226µs making 1 call to Exporter::import
133744µs14.61ms
# spent 4.61ms (3.61+994µs) within Moose::Exporter::BEGIN@13 which was called: # once (3.61ms+994µs) by Moose::BEGIN@15 at line 13
use Moose::Util::MetaRole;
# spent 4.61ms making 1 call to Moose::Exporter::BEGIN@13
143110µs2376µs
# spent 210µs (44+166) within Moose::Exporter::BEGIN@14 which was called: # once (44µs+166µs) by Moose::BEGIN@15 at line 14
use Scalar::Util qw(reftype);
# spent 210µs making 1 call to Moose::Exporter::BEGIN@14 # spent 166µs making 1 call to Exporter::import
153252µs31.50ms
# spent 786µs (69+717) within Moose::Exporter::BEGIN@15 which was called: # once (69µs+717µs) by Moose::BEGIN@15 at line 15
use Sub::Exporter 0.980;
# spent 786µs making 1 call to Moose::Exporter::BEGIN@15 # spent 659µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756] # spent 58µs making 1 call to UNIVERSAL::VERSION
163104µs2359µs
# spent 200µs (41+159) within Moose::Exporter::BEGIN@16 which was called: # once (41µs+159µs) by Moose::BEGIN@15 at line 16
use Sub::Name qw(subname);
# spent 200µs making 1 call to Moose::Exporter::BEGIN@16 # spent 159µs making 1 call to Exporter::import
17
1831.47ms124µs
# spent 24µs within Moose::Exporter::BEGIN@18 which was called: # once (24µs+0s) by Moose::BEGIN@15 at line 18
use XSLoader;
# spent 24µs making 1 call to Moose::Exporter::BEGIN@18
19
201303µs1273µsXSLoader::load( 'Moose', $XS_VERSION );
# spent 273µs making 1 call to XSLoader::load
21
2212µsmy %EXPORT_SPEC;
23
24
# spent 15.4ms (178µs+15.2) within Moose::Exporter::setup_import_methods which was called 3 times, avg 5.13ms/call: # once (66µs+5.64ms) by Moose::Meta::Attribute::BEGIN@20 at line 42 of Moose/Util/TypeConstraints.pm # once (55µs+5.00ms) by KiokuDB::Backend::BEGIN@4 at line 88 of Moose/Role.pm # once (57µs+4.56ms) by KiokuDB::BEGIN@4 at line 122 of Moose.pm
sub setup_import_methods {
25333µs my ( $class, %args ) = @_;
26
27326µs my $exporting_package = $args{exporting_package} ||= caller();
28
293118µs315.2ms $class->build_import_methods(
# spent 15.2ms making 3 calls to Moose::Exporter::build_import_methods, avg 5.07ms/call
30 %args,
31 install => [qw(import unimport init_meta)]
32 );
33}
34
35
# spent 15.2ms (828µs+14.4) within Moose::Exporter::build_import_methods which was called 3 times, avg 5.07ms/call: # 3 times (828µs+14.4ms) by Moose::Exporter::setup_import_methods at line 29, avg 5.07ms/call
sub build_import_methods {
36328µs my ( $class, %args ) = @_;
37
38312µs my $exporting_package = $args{exporting_package} ||= caller();
39
40318µs $EXPORT_SPEC{$exporting_package} = \%args;
41
42341µs3293µs my @exports_from = $class->_follow_also($exporting_package);
# spent 293µs making 3 calls to Moose::Exporter::_follow_also, avg 98µs/call
43
44312µs my $export_recorder = {};
4538µs my $is_reexport = {};
46
47352µs33.58ms my $exports = $class->_make_sub_exporter_params(
# spent 3.58ms making 3 calls to Moose::Exporter::_make_sub_exporter_params, avg 1.19ms/call
48 [ @exports_from, $exporting_package ],
49 $export_recorder,
50 $is_reexport,
51 );
52
53347µs37.26ms my $exporter = $class->_make_exporter($exports, $is_reexport);
# spent 7.26ms making 3 calls to Moose::Exporter::_make_exporter, avg 2.42ms/call
54
5536µs my %methods;
56359µs3124µs $methods{import} = $class->_make_import_sub(
# spent 124µs making 3 calls to Moose::Exporter::_make_import_sub, avg 41µs/call
57 $exporting_package,
58 $exporter,
59 \@exports_from,
60 $is_reexport
61 );
62
63347µs386µs $methods{unimport} = $class->_make_unimport_sub(
# spent 86µs making 3 calls to Moose::Exporter::_make_unimport_sub, avg 29µs/call
64 $exporting_package,
65 $exports,
66 $export_recorder,
67 $is_reexport
68 );
69
70357µs3269µs $methods{init_meta} = $class->_make_init_meta(
# spent 269µs making 3 calls to Moose::Exporter::_make_init_meta, avg 90µs/call
71 $exporting_package,
72 \%args
73 );
74
75350µs3502µs my $package = Class::MOP::Package->initialize($exporting_package);
# spent 502µs making 3 calls to Class::MOP::Package::initialize, avg 167µs/call
76337µs for my $to_install ( @{ $args{install} || [] } ) {
77937µs my $symbol = '&' . $to_install;
78 next
79991µs61000µs unless $methods{$to_install}
# spent 1000µs making 6 calls to Class::MOP::Package::has_package_symbol, avg 167µs/call
80 && !$package->has_package_symbol($symbol);
81688µs61.25ms $package->add_package_symbol( $symbol, $methods{$to_install} );
# spent 1.25ms making 6 calls to Class::MOP::Package::add_package_symbol, avg 209µs/call
82 }
83
84360µs return ( $methods{import}, $methods{unimport}, $methods{init_meta} );
85}
86
87
# spent 7.26ms (172µs+7.09) within Moose::Exporter::_make_exporter which was called 3 times, avg 2.42ms/call: # 3 times (172µs+7.09ms) by Moose::Exporter::build_import_methods at line 53, avg 2.42ms/call
sub _make_exporter {
88314µs my ($class, $exports, $is_reexport) = @_;
89
90 return Sub::Exporter::build_exporter(
91 {
92 exports => $exports,
93 groups => { default => [':all'] },
94
# spent 539ms (62.8+476) within Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:125] which was called 100 times, avg 5.39ms/call: # 100 times (62.8ms+476ms) by Sub::Exporter::_do_import at line 799 of Sub/Exporter.pm, avg 5.39ms/call
installer => sub {
95100368µs my ($arg, $to_export) = @_;
961001.29ms1003.74ms my $meta = Class::MOP::class_of($arg->{into});
# spent 3.74ms making 100 calls to Class::MOP::class_of, avg 37µs/call
97
98100257µs28.65ms goto &Sub::Exporter::default_installer unless $meta;
# spent 8.65ms making 2 calls to Sub::Exporter::default_installer, avg 4.32ms/call
99
100 # don't overwrite existing symbols with our magically flagged
101 # version of it if we would install the same sub that's already
102 # in the importer
103
10498197µs my @filtered_to_export;
10598189µs my %installed;
106987.58ms for (my $i = 0; $i < @{ $to_export }; $i += 2) {
10713346.44ms my ($as, $cv) = @{ $to_export }[$i, $i + 1];
108
109133417.0ms1336150ms next if !ref($as)
# spent 150ms making 1334 calls to Class::MOP::Package::has_package_symbol, avg 112µs/call # spent 237µs making 2 calls to Class::MOP::Package::get_package_symbol, avg 119µs/call
110 && $meta->has_package_symbol('&' . $as)
111 && $meta->get_package_symbol('&' . $as) == $cv;
112
11313325.30ms push @filtered_to_export, $as, $cv;
11413327.65ms $installed{$as} = 1 unless ref $as;
11598224µs }
116
117981.25ms98321ms Sub::Exporter::default_installer($arg, \@filtered_to_export);
# spent 321ms making 98 calls to Sub::Exporter::default_installer, avg 3.28ms/call
118
119983.04ms for my $name ( keys %{$is_reexport} ) {
1203104µs2185µs
# spent 113µs (42+72) within Moose::Exporter::BEGIN@120 which was called: # once (42µs+72µs) by Moose::BEGIN@15 at line 120
no strict 'refs';
# spent 113µs making 1 call to Moose::Exporter::BEGIN@120 # spent 72µs making 1 call to strict::unimport
12132.59ms2168µs
# spent 104µs (39+65) within Moose::Exporter::BEGIN@121 which was called: # once (39µs+65µs) by Moose::BEGIN@15 at line 121
no warnings 'once';
# spent 104µs making 1 call to Moose::Exporter::BEGIN@121 # spent 64µs making 1 call to warnings::unimport
122188591µs next unless exists $installed{$name};
1231869.09ms1861.36ms _flag_as_reexport( \*{ join q{::}, $arg->{into}, $name } );
# spent 1.36ms making 186 calls to Moose::Exporter::_flag_as_reexport, avg 7µs/call
124 }
125 },
126 }
1273156µs37.09ms );
# spent 7.09ms making 3 calls to Sub::Exporter::build_exporter, avg 2.36ms/call
128}
129
130{
13129µs my $seen = {};
132
133
# spent 293µs (182+111) within Moose::Exporter::_follow_also which was called 3 times, avg 98µs/call: # 3 times (182µs+111µs) by Moose::Exporter::build_import_methods at line 42, avg 98µs/call
sub _follow_also {
134312µs my $class = shift;
13538µs my $exporting_package = shift;
136
137324µs local %$seen = ( $exporting_package => 1 );
138
1393150µs6111µs return uniq( _follow_also_real($exporting_package) );
# spent 62µs making 3 calls to Moose::Exporter::_follow_also_real, avg 20µs/call # spent 50µs making 3 calls to List::MoreUtils::uniq, avg 17µs/call
140 }
141
142
# spent 62µs within Moose::Exporter::_follow_also_real which was called 3 times, avg 20µs/call: # 3 times (62µs+0s) by Moose::Exporter::_follow_also at line 139, avg 20µs/call
sub _follow_also_real {
143310µs my $exporting_package = shift;
144
145313µs if ( !exists $EXPORT_SPEC{$exporting_package} ) {
146 my $loaded = Class::MOP::is_class_loaded($exporting_package);
147
148 die "Package in also ($exporting_package) does not seem to "
149 . "use Moose::Exporter"
150 . ( $loaded ? "" : " (is it loaded?)" );
151 }
152
153312µs my $also = $EXPORT_SPEC{$exporting_package}{also};
154
155376µs return unless defined $also;
156
157 my @also = ref $also ? @{$also} : $also;
158
159 for my $package (@also) {
160 die
161 "Circular reference in 'also' parameter to Moose::Exporter between $exporting_package and $package"
162 if $seen->{$package};
163
164 $seen->{$package} = 1;
165 }
166
167 return @also, map { _follow_also_real($_) } @also;
168 }
169}
170
171
# spent 80µs within Moose::Exporter::_parse_trait_aliases which was called 3 times, avg 27µs/call: # 3 times (80µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 233, avg 27µs/call
sub _parse_trait_aliases {
172311µs my $class = shift;
173317µs my ($package, $aliases) = @_;
174
17536µs my @ret;
176318µs for my $alias (@$aliases) {
177 my $name;
178 if (ref($alias)) {
179 reftype($alias) eq 'ARRAY'
180 or Moose->throw_error(reftype($alias) . " references are not "
181 . "valid arguments to the 'trait_aliases' "
182 . "option");
183
184 ($alias, $name) = @$alias;
185 }
186 else {
187 ($name = $alias) =~ s/.*:://;
188 }
189 push @ret, subname "${package}::${name}" => sub () { $alias };
190 }
191
192345µs return @ret;
193}
194
195
# spent 3.58ms (1.98+1.60) within Moose::Exporter::_make_sub_exporter_params which was called 3 times, avg 1.19ms/call: # 3 times (1.98ms+1.60ms) by Moose::Exporter::build_import_methods at line 47, avg 1.19ms/call
sub _make_sub_exporter_params {
196310µs my $class = shift;
19738µs my $packages = shift;
19837µs my $export_recorder = shift;
19936µs my $is_reexport = shift;
200
20136µs my %exports;
202
203321µs for my $package ( @{$packages} ) {
204310µs my $args = $EXPORT_SPEC{$package}
205 or die "The $package package does not use Moose::Exporter\n";
206
207321µs for my $name ( @{ $args->{with_meta} } ) {
20816175µs16427µs my $sub = $class->_sub_from_package( $package, $name )
# spent 427µs making 16 calls to Moose::Exporter::_sub_from_package, avg 27µs/call
209 or next;
210
2111656µs my $fq_name = $package . '::' . $name;
212
21316259µs16437µs $exports{$name} = $class->_make_wrapped_sub_with_meta(
# spent 437µs making 16 calls to Moose::Exporter::_make_wrapped_sub_with_meta, avg 27µs/call
214 $fq_name,
215 $sub,
216 $export_recorder,
217 );
218 }
219
220322µs for my $name ( @{ $args->{with_caller} } ) {
221 my $sub = $class->_sub_from_package( $package, $name )
222 or next;
223
224 my $fq_name = $package . '::' . $name;
225
226 $exports{$name} = $class->_make_wrapped_sub(
227 $fq_name,
228 $sub,
229 $export_recorder,
230 );
231 }
232
233354µs380µs my @extra_exports = $class->_parse_trait_aliases(
# spent 80µs making 3 calls to Moose::Exporter::_parse_trait_aliases, avg 27µs/call
234 $package, $args->{trait_aliases},
235 );
236334µs for my $name ( @{ $args->{as_is} }, @extra_exports ) {
2372751µs my ( $sub, $coderef_name );
238
2392799µs if ( ref $name ) {
24047µs $sub = $name;
241
24247µs my $coderef_pkg;
243497µs434µs ( $coderef_pkg, $coderef_name )
# spent 34µs making 4 calls to Class::MOP::get_code_info, avg 8µs/call
244 = Class::MOP::get_code_info($name);
245
246423µs if ( $coderef_pkg ne $package ) {
247 $is_reexport->{$coderef_name} = 1;
248 }
249 }
250 else {
25123248µs23626µs $sub = $class->_sub_from_package( $package, $name )
# spent 626µs making 23 calls to Moose::Exporter::_sub_from_package, avg 27µs/call
252 or next;
253
2542366µs $coderef_name = $name;
255 }
256
25727155µs $export_recorder->{$sub} = 1;
258
2596437.60ms
# spent 5.36ms within Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:259] which was called 616 times, avg 9µs/call: # 616 times (5.36ms+0s) by Sub::Exporter::default_generator at line 856 of Sub/Exporter.pm, avg 9µs/call
$exports{$coderef_name} = sub {$sub};
260 }
261 }
262
263344µs return \%exports;
264}
265
266
# spent 1.05ms within Moose::Exporter::_sub_from_package which was called 39 times, avg 27µs/call: # 23 times (626µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 251, avg 27µs/call # 16 times (427µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 208, avg 27µs/call
sub _sub_from_package {
26739108µs my $sclass = shift;
2683983µs my $package = shift;
2693987µs my $name = shift;
270
27139159µs my $sub = do {
27234.71ms2193µs
# spent 119µs (44+74) within Moose::Exporter::BEGIN@272 which was called: # once (44µs+74µs) by Moose::BEGIN@15 at line 272
no strict 'refs';
# spent 119µs making 1 call to Moose::Exporter::BEGIN@272 # spent 74µs making 1 call to strict::unimport
27339286µs \&{ $package . '::' . $name };
274 };
275
27639471µs return $sub if defined &$sub;
277
278 Carp::cluck "Trying to export undefined sub ${package}::${name}";
279
280 return;
281}
282
28312µsour $CALLER;
284
285sub _make_wrapped_sub {
286 my $self = shift;
287 my $fq_name = shift;
288 my $sub = shift;
289 my $export_recorder = shift;
290
291 # We need to set the package at import time, so that when
292 # package Foo imports has(), we capture "Foo" as the
293 # package. This lets other packages call Foo::has() and get
294 # the right package. This is done for backwards compatibility
295 # with existing production code, not because this is a good
296 # idea ;)
297 return sub {
298 my $caller = $CALLER;
299
300 my $wrapper = $self->_curry_wrapper( $sub, $fq_name, $caller );
301
302 my $sub = subname( $fq_name => $wrapper );
303
304 $export_recorder->{$sub} = 1;
305
306 return $sub;
307 };
308}
309
310
# spent 437µs within Moose::Exporter::_make_wrapped_sub_with_meta which was called 16 times, avg 27µs/call: # 16 times (437µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 213, avg 27µs/call
sub _make_wrapped_sub_with_meta {
3111652µs my $self = shift;
3121650µs my $fq_name = shift;
3131635µs my $sub = shift;
3141631µs my $export_recorder = shift;
315
316
# spent 81.2ms (41.8+39.4) within Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:329] which was called 752 times, avg 108µs/call: # 752 times (41.8ms+39.4ms) by Sub::Exporter::default_generator at line 856 of Sub/Exporter.pm, avg 108µs/call
return sub {
3177522.24ms my $caller = $CALLER;
318
319 my $wrapper = $self->_late_curry_wrapper(
320 $sub, $fq_name,
32196818.9ms96836.9ms
# spent 12.8ms (4.97+7.82) within Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:321] which was called 216 times, avg 59µs/call: # 216 times (4.97ms+7.82ms) by Moose::Role::after or Moose::Role::around or Moose::Role::before or Moose::Role::has or Moose::Role::override or Moose::Role::requires or Moose::Role::with or Moose::before or Moose::extends or Moose::has or Moose::with at line 358, avg 59µs/call
sub { Class::MOP::class_of(shift) } => $caller
# spent 29.1ms making 752 calls to Moose::Exporter::_late_curry_wrapper, avg 39µs/call # spent 7.82ms making 216 calls to Class::MOP::class_of, avg 36µs/call
322 );
323
32475219.4ms75210.3ms my $sub = subname( $fq_name => $wrapper );
# spent 10.3ms making 752 calls to Sub::Name::subname, avg 14µs/call
325
3267525.37ms $export_recorder->{$sub} = 1;
327
3287529.12ms return $sub;
32916328µs };
330}
331
332sub _curry_wrapper {
333 my $class = shift;
334 my $sub = shift;
335 my $fq_name = shift;
336 my @extra = @_;
337
338 my $wrapper = sub { $sub->( @extra, @_ ) };
339 if ( my $proto = prototype $sub ) {
340
341 # XXX - Perl's prototype sucks. Use & to make set_prototype
342 # ignore the fact that we're passing "private variables"
343 &Scalar::Util::set_prototype( $wrapper, $proto );
344 }
345 return $wrapper;
346}
347
348
# spent 29.1ms within Moose::Exporter::_late_curry_wrapper which was called 752 times, avg 39µs/call: # 752 times (29.1ms+0s) by Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:329] at line 321, avg 39µs/call
sub _late_curry_wrapper {
3497522.47ms my $class = shift;
3507521.86ms my $sub = shift;
3517521.81ms my $fq_name = shift;
3527521.54ms my $extra = shift;
3537523.84ms my @ex_args = @_;
354
355 my $wrapper = sub {
356
357 # resolve curried arguments at runtime via this closure
3582163.11ms21612.8ms my @curry = ( $extra->(@ex_args) );
# spent 12.8ms making 216 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:321], avg 59µs/call
3592166.11ms2167.46s return $sub->( @curry, @_ );
# spent 4.17s making 108 calls to Moose::has, avg 38.6ms/call # spent 2.83s making 51 calls to Moose::Role::with, avg 55.5ms/call, recursion: max depth 3, sum of overlapping time 793ms # spent 1.26s making 13 calls to Moose::with, avg 96.7ms/call, recursion: max depth 1, sum of overlapping time 33.0ms # spent 10.5ms making 15 calls to Moose::Role::requires, avg 697µs/call # spent 5.90ms making 1 call to Moose::extends # spent 5.59ms making 7 calls to Moose::Role::has, avg 798µs/call # spent 2.78ms making 13 calls to Moose::Role::around, avg 214µs/call # spent 1.53ms making 4 calls to Moose::Role::override, avg 383µs/call # spent 1.39ms making 1 call to Moose::before # spent 436µs making 2 calls to Moose::Role::before, avg 218µs/call # spent 227µs making 1 call to Moose::Role::after
3607528.72ms };
361
3627522.05ms if ( my $proto = prototype $sub ) {
363
364 # XXX - Perl's prototype sucks. Use & to make set_prototype
365 # ignore the fact that we're passing "private variables"
366 &Scalar::Util::set_prototype( $wrapper, $proto );
367 }
36875210.5ms return $wrapper;
369}
370
371
# spent 124µs within Moose::Exporter::_make_import_sub which was called 3 times, avg 41µs/call: # 3 times (124µs+0s) by Moose::Exporter::build_import_methods at line 56, avg 41µs/call
sub _make_import_sub {
37239µs shift;
373312µs my $exporting_package = shift;
37438µs my $exporter = shift;
37536µs my $exports_from = shift;
37636µs my $is_reexport = shift;
377
378
# spent 1.73s (23.9ms+1.70) within Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:456] which was called 100 times, avg 17.3ms/call: # once (229µs+38.5ms) by Moose::Meta::Attribute::Native::Trait::BEGIN@3 at line 3 of Moose/Meta/Attribute/Native/Trait.pm # once (253µs+27.2ms) by KiokuDB::Collapser::BEGIN@4 at line 4 of KiokuDB/Collapser.pm # once (259µs+26.2ms) by Moose::Meta::Method::Accessor::Native::Hash::delete::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Hash/delete.pm # once (228µs+25.2ms) by KiokuDB::LiveObjects::BEGIN@4 at line 4 of KiokuDB/LiveObjects.pm # once (254µs+25.2ms) by KiokuDB::BEGIN@4 at line 4 of KiokuDB.pm # once (229µs+24.9ms) by Data::Stream::Bulk::Cat::BEGIN@10 at line 10 of Data/Stream/Bulk/Cat.pm # once (266µs+24.5ms) by KiokuDB::Entry::Skip::BEGIN@4 at line 4 of KiokuDB/Entry/Skip.pm # once (231µs+24.2ms) by KiokuDB::TypeMap::Entry::Alias::BEGIN@4 at line 4 of KiokuDB/TypeMap/Entry/Alias.pm # once (234µs+23.4ms) by Devel::PartialDump::BEGIN@4 at line 4 of Devel/PartialDump.pm # once (230µs+23.4ms) by KiokuDB::Error::UnknownObjects::BEGIN@2 at line 2 of KiokuDB/Error/UnknownObjects.pm # once (228µs+23.1ms) by Data::Stream::Bulk::Filter::BEGIN@10 at line 10 of Data/Stream/Bulk/Filter.pm # once (230µs+22.8ms) by Data::Visitor::BEGIN@4 at line 4 of Data/Visitor.pm # once (232µs+22.8ms) by KiokuDB::TypeMap::Shadow::BEGIN@4 at line 4 of KiokuDB/TypeMap/Shadow.pm # once (279µs+22.7ms) by KiokuDB::Stream::Objects::BEGIN@4 at line 4 of KiokuDB/Stream/Objects.pm # once (267µs+22.7ms) by KiokuDB::LiveObjects::TXNScope::BEGIN@4 at line 4 of KiokuDB/LiveObjects/TXNScope.pm # once (228µs+22.8ms) by KiokuDB::TypeMap::BEGIN@4 at line 4 of KiokuDB/TypeMap.pm # once (241µs+22.7ms) by Data::Stream::Bulk::Nil::BEGIN@10 at line 10 of Data/Stream/Bulk/Nil.pm # once (229µs+22.7ms) by KiokuDB::Linker::BEGIN@4 at line 4 of KiokuDB/Linker.pm # once (229µs+22.7ms) by KiokuDB::Thunk::BEGIN@4 at line 4 of KiokuDB/Thunk.pm # once (231µs+22.6ms) by KiokuDB::TypeMap::Entry::Compiled::BEGIN@2 at line 2 of KiokuDB/TypeMap/Entry/Compiled.pm # once (230µs+22.6ms) by KiokuDB::LiveObjects::Scope::BEGIN@4 at line 4 of KiokuDB/LiveObjects/Scope.pm # once (228µs+22.6ms) by KiokuDB::TypeMap::Resolver::BEGIN@4 at line 4 of KiokuDB/TypeMap/Resolver.pm # once (229µs+22.5ms) by KiokuDB::Error::MissingObjects::BEGIN@2 at line 2 of KiokuDB/Error/MissingObjects.pm # once (229µs+22.5ms) by KiokuDB::TypeMap::Entry::MOP::BEGIN@4 at line 4 of KiokuDB/TypeMap/Entry/MOP.pm # once (230µs+22.4ms) by KiokuDB::Reference::BEGIN@4 at line 4 of KiokuDB/Reference.pm # once (230µs+22.3ms) by KiokuDB::Collapser::Buffer::BEGIN@2 at line 2 of KiokuDB/Collapser/Buffer.pm # once (225µs+22.1ms) by KiokuDB::Entry::BEGIN@4 at line 4 of KiokuDB/Entry.pm # once (324µs+20.4ms) by KiokuDB::TypeMap::Entry::Std::ID::BEGIN@2 at line 2 of KiokuDB/TypeMap/Entry/Std/ID.pm # once (306µs+19.7ms) by Moose::Meta::Method::Accessor::Native::Array::insert::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/insert.pm # once (241µs+17.7ms) by Moose::Meta::Method::Accessor::Native::Array::grep::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/grep.pm # once (293µs+17.1ms) by Throwable::BEGIN@5 at line 5 of Throwable.pm # once (348µs+16.9ms) by Moose::Meta::Method::Accessor::Native::Array::splice::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/splice.pm # once (237µs+16.6ms) by Moose::Meta::Method::Accessor::Native::Hash::clear::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Hash/clear.pm # once (306µs+16.4ms) by KiokuDB::TypeMap::Entry::Std::Compile::BEGIN@2 at line 2 of KiokuDB/TypeMap/Entry/Std/Compile.pm # once (242µs+16.1ms) by Moose::Meta::Method::Accessor::Native::Array::first::BEGIN@13 at line 13 of Moose/Meta/Method/Accessor/Native/Array/first.pm # once (231µs+15.2ms) by KiokuDB::Error::BEGIN@2 at line 2 of KiokuDB/Error.pm # once (263µs+15.1ms) by KiokuDB::TypeMap::Entry::BEGIN@4 at line 4 of KiokuDB/TypeMap/Entry.pm # once (248µs+15.0ms) by KiokuDB::Backend::BEGIN@4 at line 4 of KiokuDB/Backend.pm # once (229µs+14.9ms) by Moose::Meta::Attribute::Native::Trait::Array::BEGIN@3 at line 3 of Moose/Meta/Attribute/Native/Trait/Array.pm # once (229µs+14.9ms) by Moose::Meta::Attribute::Native::Trait::Hash::BEGIN@3 at line 3 of Moose/Meta/Attribute/Native/Trait/Hash.pm # once (244µs+14.8ms) by KiokuDB::TypeMap::Entry::Std::Intrinsic::BEGIN@2 at line 2 of KiokuDB/TypeMap/Entry/Std/Intrinsic.pm # once (229µs+14.8ms) by Moose::Meta::Method::Accessor::Native::Array::Writer::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/Writer.pm # once (303µs+14.7ms) by Moose::Meta::Method::Accessor::Native::Array::clear::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/clear.pm # once (228µs+14.7ms) by Moose::Meta::Method::Accessor::Native::Array::elements::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/elements.pm # once (226µs+14.6ms) by Moose::Meta::Method::Accessor::Native::Array::BEGIN@6 at line 6 of Moose/Meta/Method/Accessor/Native/Array.pm # once (265µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Hash::count::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/count.pm # once (228µs+14.6ms) by Moose::Meta::Method::Accessor::Native::Array::set::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/set.pm # once (228µs+14.6ms) by Moose::Meta::Method::Accessor::Native::Array::map::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/map.pm # once (228µs+14.6ms) by Moose::Meta::Method::Accessor::Native::Writer::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (235µs+14.6ms) by Moose::Meta::Method::Accessor::Native::Array::get::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/get.pm # once (243µs+14.5ms) by KiokuDB::Role::API::BEGIN@2 at line 2 of KiokuDB/Role/API.pm # once (229µs+14.5ms) by MooseX::Clone::BEGIN@4 at line 4 of MooseX/Clone.pm # once (229µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::is_empty::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/is_empty.pm # once (227µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::sort_in_place::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/sort_in_place.pm # once (229µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::push::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/push.pm # once (244µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Hash::keys::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/keys.pm # once (232µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::delete::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/delete.pm # once (234µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::reduce::BEGIN@13 at line 13 of Moose/Meta/Method/Accessor/Native/Array/reduce.pm # once (229µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::accessor::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/accessor.pm # once (233µs+14.5ms) by KiokuDB::TypeMap::Entry::Std::BEGIN@4 at line 4 of KiokuDB/TypeMap/Entry/Std.pm # once (235µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Hash::elements::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/elements.pm # once (241µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::sort::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/sort.pm # once (345µs+14.4ms) by KiokuDB::TypeMap::Entry::Std::Expand::BEGIN@2 at line 2 of KiokuDB/TypeMap/Entry/Std/Expand.pm # once (229µs+14.5ms) by Moose::Meta::Method::Accessor::Native::Array::pop::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/pop.pm # once (231µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Array::shift::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/shift.pm # once (231µs+14.4ms) by KiokuDB::Role::UUIDs::LibUUID::BEGIN@4 at line 4 of KiokuDB/Role/UUIDs/LibUUID.pm # once (231µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Array::natatime::BEGIN@13 at line 13 of Moose/Meta/Method/Accessor/Native/Array/natatime.pm # once (230µs+14.4ms) by Data::Stream::Bulk::BEGIN@10 at line 10 of Data/Stream/Bulk.pm # once (237µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Hash::accessor::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Hash/accessor.pm # once (227µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Array::join::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/join.pm # once (227µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Array::uniq::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/uniq.pm # once (230µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Array::shuffle::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Array/shuffle.pm # once (229µs+14.4ms) by KiokuDB::Role::TypeMap::BEGIN@4 at line 4 of KiokuDB/Role/TypeMap.pm # once (229µs+14.4ms) by KiokuDB::Role::UUIDs::BEGIN@4 at line 4 of KiokuDB/Role/UUIDs.pm # once (228µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Array::count::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/count.pm # once (226µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Hash::is_empty::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/is_empty.pm # once (245µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Array::unshift::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Array/unshift.pm # once (232µs+14.4ms) by MooseX::Clone::Meta::Attribute::Trait::NoClone::BEGIN@4 at line 4 of MooseX/Clone/Meta/Attribute/Trait/NoClone.pm # once (229µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Hash::get::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/get.pm # once (228µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Hash::Writer::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/Writer.pm # once (227µs+14.4ms) by Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Collection.pm # once (229µs+14.3ms) by MooseX::Clone::Meta::Attribute::Trait::Copy::BEGIN@4 at line 4 of MooseX/Clone/Meta/Attribute/Trait/Copy.pm # once (226µs+14.3ms) by Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13 at line 13 of Moose/Meta/Method/Accessor/Native/Hash/set.pm # once (227µs+14.3ms) by Moose::Meta::Method::Accessor::Native::Hash::exists::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/exists.pm # once (245µs+14.3ms) by Moose::Meta::Method::Accessor::Native::Hash::values::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/values.pm # once (226µs+14.3ms) by Moose::Meta::Method::Accessor::Native::Hash::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Hash.pm # once (231µs+14.3ms) by MooseX::Clone::Meta::Attribute::Trait::StrableClone::BEGIN@4 at line 4 of MooseX/Clone/Meta/Attribute/Trait/StorableClone.pm # once (226µs+14.3ms) by Moose::Meta::Method::Accessor::Native::Hash::kv::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/kv.pm # once (226µs+14.3ms) by Moose::Meta::Method::Accessor::Native::Reader::BEGIN@10 at line 10 of Moose/Meta/Method/Accessor/Native/Reader.pm # once (234µs+14.2ms) by Moose::Meta::Method::Accessor::Native::Hash::defined::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native/Hash/defined.pm # once (240µs+14.2ms) by MooseX::Clone::Meta::Attribute::Trait::Clone::BEGIN@4 at line 4 of MooseX/Clone/Meta/Attribute/Trait/Clone.pm # once (229µs+14.2ms) by MooseX::Clone::Meta::Attribute::Trait::Clone::Base::BEGIN@4 at line 4 of MooseX/Clone/Meta/Attribute/Trait/Clone/Base.pm # once (229µs+14.2ms) by MooseX::Clone::Meta::Attribute::Trait::Clone::Std::BEGIN@2 at line 2 of MooseX/Clone/Meta/Attribute/Trait/Clone/Std.pm # once (227µs+14.0ms) by Moose::Meta::Method::Accessor::Native::BEGIN@13 at line 13 of Moose/Meta/Method/Accessor/Native.pm # once (203µs+10.8ms) by KiokuDB::LiveObjects::BEGIN@16 at line 16 of KiokuDB/LiveObjects.pm # once (316µs+10.3ms) by Moose::BEGIN@35 at line 35 of Moose.pm # once (207µs+10.4ms) by Moose::Meta::Attribute::Native::Trait::BEGIN@6 at line 6 of Moose/Meta/Attribute/Native/Trait.pm # once (199µs+10.3ms) by KiokuDB::Entry::BEGIN@6 at line 6 of KiokuDB/Entry.pm # once (199µs+10.3ms) by KiokuDB::Backend::BEGIN@6 at line 6 of KiokuDB/Backend.pm # once (196µs+7.83ms) by Moose::Role::BEGIN@19 at line 19 of Moose/Role.pm
return sub {
379
380 # I think we could use Sub::Exporter's collector feature
381 # to do this, but that would be rather gross, since that
382 # feature isn't really designed to return a value to the
383 # caller of the exporter sub.
384 #
385 # Also, this makes sure we preserve backwards compat for
386 # _get_caller, so it always sees the arguments in the
387 # expected order.
388100224µs my $traits;
3891001.74ms1006.34ms ( $traits, @_ ) = _strip_traits(@_);
# spent 6.34ms making 100 calls to Moose::Exporter::_strip_traits, avg 63µs/call
390
391100190µs my $metaclass;
3921001.54ms1004.43ms ( $metaclass, @_ ) = _strip_metaclass(@_);
# spent 4.43ms making 100 calls to Moose::Exporter::_strip_metaclass, avg 44µs/call
393100257µs $metaclass
394 = Moose::Util::resolve_metaclass_alias( 'Class' => $metaclass )
395 if defined $metaclass && length $metaclass;
396
397100185µs my $meta_name;
3981001.66ms1004.37ms ( $meta_name, @_ ) = _strip_meta_name(@_);
# spent 4.37ms making 100 calls to Moose::Exporter::_strip_meta_name, avg 44µs/call
399
400 # Normally we could look at $_[0], but in some weird cases
401 # (involving goto &Moose::import), $_[0] ends as something
402 # else (like Squirrel).
403100348µs my $class = $exporting_package;
404
4051001.21ms1001.60ms $CALLER = _get_caller(@_);
# spent 1.60ms making 100 calls to Moose::Exporter::_get_caller, avg 16µs/call
406
407 # this works because both pragmas set $^H (see perldoc
408 # perlvar) which affects the current compilation -
409 # i.e. the file who use'd us - which is why we don't need
410 # to do anything special to make it affect that file
411 # rather than this one (which is already compiled)
412
4131001.30ms1001.49ms strict->import;
# spent 1.49ms making 100 calls to strict::import, avg 15µs/call
4141001.17ms1006.70ms warnings->import;
# spent 6.70ms making 100 calls to warnings::import, avg 67µs/call
415
416100210µs my $did_init_meta;
4172004.06ms1001.20ms for my $c ( grep { $_->can('init_meta') } $class, @{$exports_from} ) {
# spent 1.20ms making 100 calls to UNIVERSAL::can, avg 12µs/call
418
419 # init_meta can apply a role, which when loaded uses
420 # Moose::Exporter, which in turn sets $CALLER, so we need
421 # to protect against that.
42294444µs local $CALLER = $CALLER;
423941.13ms94723ms $c->init_meta(
# spent 364ms making 69 calls to Moose::Role::init_meta, avg 5.27ms/call # spent 359ms making 25 calls to Moose::init_meta, avg 14.4ms/call
424 for_class => $CALLER,
425 metaclass => $metaclass,
426 meta_name => $meta_name,
427 );
42894910µs $did_init_meta = 1;
429 }
430
431100379µs if ( $did_init_meta && @{$traits} ) {
432
433 # The traits will use Moose::Role, which in turn uses
434 # Moose::Exporter, which in turn sets $CALLER, so we need
435 # to protect against that.
436 local $CALLER = $CALLER;
437 _apply_meta_traits( $CALLER, $traits );
438 }
439 elsif ( @{$traits} ) {
440 require Moose;
441 Moose->throw_error(
442 "Cannot provide traits when $class does not have an init_meta() method"
443 );
444 }
445
446100451µs my ( undef, @args ) = @_;
447100315µs my $extra = shift @args if ref $args[0] eq 'HASH';
448
449100221µs $extra ||= {};
450100561µs if ( !$extra->{into} ) {
451100386µs $extra->{into_level} ||= 0;
452100311µs $extra->{into_level}++;
453 }
454
4551003.62ms100953ms $class->$exporter( $extra, @args );
# spent 953ms making 100 calls to Sub::Exporter::__ANON__[Sub/Exporter.pm:756], avg 9.53ms/call
456393µs };
457}
458
459
# spent 6.34ms (4.45+1.89) within Moose::Exporter::_strip_traits which was called 100 times, avg 63µs/call: # 100 times (4.45ms+1.89ms) by Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:456] at line 389, avg 63µs/call
sub _strip_traits {
4602004.84ms1001.89ms my $idx = first_index { ( $_ || '' ) eq '-traits' } @_;
# spent 1.89ms making 100 calls to List::MoreUtils::firstidx, avg 19µs/call
461
4621001.89ms return ( [], @_ ) unless $idx >= 0 && $#_ >= $idx + 1;
463
464 my $traits = $_[ $idx + 1 ];
465
466 splice @_, $idx, 2;
467
468 $traits = [$traits] unless ref $traits;
469
470 return ( $traits, @_ );
471}
472
473
# spent 4.43ms (3.28+1.16) within Moose::Exporter::_strip_metaclass which was called 100 times, avg 44µs/call: # 100 times (3.28ms+1.16ms) by Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:456] at line 392, avg 44µs/call
sub _strip_metaclass {
4742003.20ms1001.16ms my $idx = first_index { ( $_ || '' ) eq '-metaclass' } @_;
# spent 1.16ms making 100 calls to List::MoreUtils::firstidx, avg 12µs/call
475
4761001.53ms return ( undef, @_ ) unless $idx >= 0 && $#_ >= $idx + 1;
477
478 my $metaclass = $_[ $idx + 1 ];
479
480 splice @_, $idx, 2;
481
482 return ( $metaclass, @_ );
483}
484
485
# spent 4.37ms (3.24+1.13) within Moose::Exporter::_strip_meta_name which was called 100 times, avg 44µs/call: # 100 times (3.24ms+1.13ms) by Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:456] at line 398, avg 44µs/call
sub _strip_meta_name {
4862003.13ms1001.13ms my $idx = first_index { ( $_ || '' ) eq '-meta_name' } @_;
# spent 1.13ms making 100 calls to List::MoreUtils::firstidx, avg 11µs/call
487
4881001.59ms return ( 'meta', @_ ) unless $idx >= 0 && $#_ >= $idx + 1;
489
490 my $meta_name = $_[ $idx + 1 ];
491
492 splice @_, $idx, 2;
493
494 return ( $meta_name, @_ );
495}
496
497sub _apply_meta_traits {
498 my ( $class, $traits ) = @_;
499
500 return unless @{$traits};
501
502 my $meta = Class::MOP::class_of($class);
503
504 my $type = ( split /::/, ref $meta )[-1]
505 or Moose->throw_error(
506 'Cannot determine metaclass type for trait application . Meta isa '
507 . ref $meta );
508
509 my @resolved_traits = map {
510 ref $_
511 ? $_
512 : Moose::Util::resolve_metatrait_alias( $type => $_ )
513 } @$traits;
514
515 return unless @resolved_traits;
516
517 my %args = ( for => $class );
518
519 if ( $meta->isa('Moose::Meta::Role') ) {
520 $args{role_metaroles} = { role => \@resolved_traits };
521 }
522 else {
523 $args{class_metaroles} = { class => \@resolved_traits };
524 }
525
526 Moose::Util::MetaRole::apply_metaroles(%args);
527}
528
529
# spent 1.60ms within Moose::Exporter::_get_caller which was called 100 times, avg 16µs/call: # 100 times (1.60ms+0s) by Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:456] at line 405, avg 16µs/call
sub _get_caller {
530
531 # 1 extra level because it's called by import so there's a layer
532 # of indirection
533100289µs my $offset = 1;
534
535 return
5361001.82ms ( ref $_[1] && defined $_[1]->{into} ) ? $_[1]->{into}
537 : ( ref $_[1] && defined $_[1]->{into_level} )
538 ? caller( $offset + $_[1]->{into_level} )
539 : caller($offset);
540}
541
542
# spent 86µs within Moose::Exporter::_make_unimport_sub which was called 3 times, avg 29µs/call: # 3 times (86µs+0s) by Moose::Exporter::build_import_methods at line 63, avg 29µs/call
sub _make_unimport_sub {
54337µs shift;
54439µs my $exporting_package = shift;
54537µs my $exports = shift;
54636µs my $export_recorder = shift;
54736µs my $is_reexport = shift;
548
549
# spent 36.0ms (2.31+33.7) within Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:557] which was called 48 times, avg 749µs/call: # once (71µs+1.17ms) by Moose::Meta::Method::Accessor::Native::Array::first::BEGIN@44 at line 44 of Moose/Meta/Method/Accessor/Native/Array/first.pm # once (60µs+963µs) by Moose::Meta::Method::Accessor::Native::Array::grep::BEGIN@43 at line 43 of Moose/Meta/Method/Accessor/Native/Array/grep.pm # once (46µs+809µs) by Moose::Meta::Method::Accessor::Native::Array::splice::BEGIN@60 at line 60 of Moose/Meta/Method/Accessor/Native/Array/splice.pm # once (46µs+769µs) by Moose::Meta::Method::Accessor::Native::Hash::elements::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Hash/elements.pm # once (45µs+760µs) by Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@100 at line 100 of Moose/Meta/Method/Accessor/Native/Hash/set.pm # once (61µs+741µs) by Moose::Meta::Method::Accessor::Native::Array::insert::BEGIN@64 at line 64 of Moose/Meta/Method/Accessor/Native/Array/insert.pm # once (45µs+750µs) by Moose::Meta::Method::Accessor::Native::Array::unshift::BEGIN@41 at line 41 of Moose/Meta/Method/Accessor/Native/Array/unshift.pm # once (61µs+723µs) by Moose::Meta::Method::Accessor::Native::Array::is_empty::BEGIN@24 at line 24 of Moose/Meta/Method/Accessor/Native/Array/is_empty.pm # once (45µs+725µs) by Moose::Meta::Method::Accessor::Native::Array::uniq::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Array/uniq.pm # once (46µs+722µs) by Moose::Meta::Method::Accessor::Native::Array::push::BEGIN@41 at line 41 of Moose/Meta/Method/Accessor/Native/Array/push.pm # once (55µs+708µs) by Moose::Meta::Method::Accessor::Native::Array::set::BEGIN@71 at line 71 of Moose/Meta/Method/Accessor/Native/Array/set.pm # once (46µs+718µs) by Moose::Meta::Method::Accessor::Native::Array::clear::BEGIN@36 at line 36 of Moose/Meta/Method/Accessor/Native/Array/clear.pm # once (46µs+714µs) by Moose::Meta::Method::Accessor::Native::Array::pop::BEGIN@49 at line 49 of Moose/Meta/Method/Accessor/Native/Array/pop.pm # once (46µs+706µs) by Moose::Meta::Method::Accessor::Native::Hash::defined::BEGIN@42 at line 42 of Moose/Meta/Method/Accessor/Native/Hash/defined.pm # once (61µs+691µs) by Moose::Meta::Method::Accessor::Native::Hash::accessor::BEGIN@80 at line 80 of Moose/Meta/Method/Accessor/Native/Hash/accessor.pm # once (76µs+671µs) by Moose::Meta::Method::Accessor::Native::Hash::kv::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Hash/kv.pm # once (45µs+701µs) by Moose::Meta::Method::Accessor::Native::Array::accessor::BEGIN@77 at line 77 of Moose/Meta/Method/Accessor/Native/Array/accessor.pm # once (46µs+700µs) by Moose::Meta::Method::Accessor::Native::Array::sort_in_place::BEGIN@45 at line 45 of Moose/Meta/Method/Accessor/Native/Array/sort_in_place.pm # once (45µs+697µs) by Moose::Meta::Method::Accessor::Native::Array::natatime::BEGIN@57 at line 57 of Moose/Meta/Method/Accessor/Native/Array/natatime.pm # once (46µs+693µs) by Moose::Meta::Method::Accessor::Native::Array::delete::BEGIN@55 at line 55 of Moose/Meta/Method/Accessor/Native/Array/delete.pm # once (46µs+693µs) by Moose::Meta::Method::Accessor::Native::Array::shift::BEGIN@51 at line 51 of Moose/Meta/Method/Accessor/Native/Array/shift.pm # once (45µs+693µs) by Moose::Meta::Method::Accessor::Native::Hash::values::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Hash/values.pm # once (46µs+691µs) by Moose::Meta::Method::Accessor::Native::Array::count::BEGIN@23 at line 23 of Moose/Meta/Method/Accessor/Native/Array/count.pm # once (45µs+692µs) by Moose::Meta::Method::Accessor::Native::Array::sort::BEGIN@41 at line 41 of Moose/Meta/Method/Accessor/Native/Array/sort.pm # once (46µs+690µs) by Moose::Meta::Method::Accessor::Native::Array::reduce::BEGIN@44 at line 44 of Moose/Meta/Method/Accessor/Native/Array/reduce.pm # once (43µs+688µs) by Moose::Meta::Method::Accessor::Native::Array::shuffle::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Array/shuffle.pm # once (43µs+687µs) by Moose::Meta::Method::Accessor::Native::Array::map::BEGIN@43 at line 43 of Moose/Meta/Method/Accessor/Native/Array/map.pm # once (43µs+687µs) by Moose::Meta::Method::Accessor::Native::Array::elements::BEGIN@24 at line 24 of Moose/Meta/Method/Accessor/Native/Array/elements.pm # once (44µs+685µs) by Moose::Meta::Method::Accessor::Native::Array::BEGIN@23 at line 23 of Moose/Meta/Method/Accessor/Native/Array.pm # once (43µs+683µs) by Moose::Meta::Method::Accessor::Native::Array::join::BEGIN@43 at line 43 of Moose/Meta/Method/Accessor/Native/Array/join.pm # once (44µs+680µs) by Moose::Meta::Method::Accessor::Native::Hash::clear::BEGIN@36 at line 36 of Moose/Meta/Method/Accessor/Native/Hash/clear.pm # once (58µs+665µs) by Moose::Meta::Method::Accessor::Native::Hash::Writer::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Hash/Writer.pm # once (45µs+677µs) by Moose::Meta::Method::Accessor::Native::Hash::is_empty::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Hash/is_empty.pm # once (53µs+669µs) by Moose::Meta::Method::Accessor::Native::Collection::BEGIN@147 at line 147 of Moose/Meta/Method/Accessor/Native/Collection.pm # once (45µs+676µs) by Moose::Meta::Method::Accessor::Native::Hash::delete::BEGIN@41 at line 41 of Moose/Meta/Method/Accessor/Native/Hash/delete.pm # once (44µs+676µs) by Moose::Meta::Method::Accessor::Native::Hash::exists::BEGIN@42 at line 42 of Moose/Meta/Method/Accessor/Native/Hash/exists.pm # once (43µs+671µs) by Moose::Meta::Method::Accessor::Native::Hash::get::BEGIN@41 at line 41 of Moose/Meta/Method/Accessor/Native/Hash/get.pm # once (45µs+667µs) by Moose::Meta::Method::Accessor::Native::Hash::keys::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Hash/keys.pm # once (45µs+666µs) by Moose::Meta::Attribute::Native::Trait::Hash::BEGIN@27 at line 27 of Moose/Meta/Attribute/Native/Trait/Hash.pm # once (43µs+661µs) by Moose::Meta::Method::Accessor::Native::Hash::count::BEGIN@26 at line 26 of Moose/Meta/Method/Accessor/Native/Hash/count.pm # once (46µs+653µs) by Moose::Meta::Attribute::Native::Trait::Array::BEGIN@38 at line 38 of Moose/Meta/Attribute/Native/Trait/Array.pm # once (43µs+648µs) by Moose::Meta::Method::Accessor::Native::Hash::BEGIN@21 at line 21 of Moose/Meta/Method/Accessor/Native/Hash.pm # once (48µs+638µs) by Moose::Meta::Method::Accessor::Native::Writer::BEGIN@187 at line 187 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (44µs+642µs) by Moose::Meta::Method::Accessor::Native::Reader::BEGIN@63 at line 63 of Moose/Meta/Method/Accessor/Native/Reader.pm # once (44µs+620µs) by Moose::Meta::Method::Accessor::Native::BEGIN@144 at line 144 of Moose/Meta/Method/Accessor/Native.pm # once (45µs+616µs) by Moose::Meta::Attribute::Native::Trait::BEGIN@198 at line 198 of Moose/Meta/Attribute/Native/Trait.pm # once (47µs+605µs) by Moose::Meta::Attribute::Native::Trait::BEGIN@197 at line 197 of Moose/Meta/Attribute/Native/Trait.pm # once (46µs+505µs) by Throwable::BEGIN@31 at line 31 of Throwable.pm
return sub {
55048235µs my $caller = scalar caller();
551 Moose::Exporter->_remove_keywords(
552 $caller,
553482.14ms4833.7ms [ keys %{$exports} ],
# spent 33.7ms making 48 calls to Moose::Exporter::_remove_keywords, avg 701µs/call
554 $export_recorder,
555 $is_reexport,
556 );
557360µs };
558}
559
560
# spent 33.7ms (33.0+621µs) within Moose::Exporter::_remove_keywords which was called 48 times, avg 701µs/call: # 48 times (33.0ms+621µs) by Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:557] at line 553, avg 701µs/call
sub _remove_keywords {
56148137µs shift;
56248148µs my $package = shift;
56348124µs my $keywords = shift;
56448118µs my $recorded_exports = shift;
56548114µs my $is_reexport = shift;
566
5673276µs2195µs
# spent 119µs (43+76) within Moose::Exporter::BEGIN@567 which was called: # once (43µs+76µs) by Moose::BEGIN@15 at line 567
no strict 'refs';
# spent 119µs making 1 call to Moose::Exporter::BEGIN@567 # spent 76µs making 1 call to strict::unimport
568
56948964µs foreach my $name ( @{$keywords} ) {
5706758.84ms if ( defined &{ $package . '::' . $name } ) {
5716755.64ms my $sub = \&{ $package . '::' . $name };
572
573 # make sure it is from us
5746752.81ms next unless $recorded_exports->{$sub};
575
5766751.77ms if ( $is_reexport->{$name} ) {
57731.26ms2159µs
# spent 99µs (38+61) within Moose::Exporter::BEGIN@577 which was called: # once (38µs+61µs) by Moose::BEGIN@15 at line 577
no strict 'refs';
# spent 99µs making 1 call to Moose::Exporter::BEGIN@577 # spent 60µs making 1 call to strict::unimport
578 next
579 unless _export_is_flagged(
580942.95ms94621µs \*{ join q{::} => $package, $name } );
# spent 621µs making 94 calls to Moose::Exporter::_export_is_flagged, avg 7µs/call
581 }
582
583 # and if it is from us, then undef the slot
58467310.4ms delete ${ $package . '::' }{$name};
585 }
586 }
587}
588
589
# spent 269µs within Moose::Exporter::_make_init_meta which was called 3 times, avg 90µs/call: # 3 times (269µs+0s) by Moose::Exporter::build_import_methods at line 70, avg 90µs/call
sub _make_init_meta {
59037µs shift;
591310µs my $class = shift;
59238µs my $args = shift;
593
59436µs my %old_style_roles;
595366µs for my $role (
596 map {"${_}_roles"}
597 qw(
598 metaclass
599 attribute_metaclass
600 method_metaclass
601 wrapped_method_metaclass
602 instance_metaclass
603 constructor_class
604 destructor_class
605 error_class
606 )
607 ) {
6082498µs $old_style_roles{$role} = $args->{$role}
609 if exists $args->{$role};
610 }
611
61236µs my %base_class_roles;
61338µs %base_class_roles = ( roles => $args->{base_class_roles} )
614 if exists $args->{base_class_roles};
615
616 my %new_style_roles = map { $_ => $args->{$_} }
617319µs grep { exists $args->{$_} } qw( class_metaroles role_metaroles );
618
619346µs return unless %new_style_roles || %old_style_roles || %base_class_roles;
620
621 return sub {
622 shift;
623 my %options = @_;
624
625 return unless Class::MOP::class_of( $options{for_class} );
626
627 if ( %new_style_roles || %old_style_roles ) {
628 Moose::Util::MetaRole::apply_metaroles(
629 for => $options{for_class},
630 %new_style_roles,
631 %old_style_roles,
632 );
633 }
634
635 Moose::Util::MetaRole::apply_base_class_roles(
636 for_class => $options{for_class},
637 %base_class_roles,
638 )
639 if Class::MOP::class_of( $options{for_class} )
640 ->isa('Moose::Meta::Class');
641
642 return Class::MOP::class_of( $options{for_class} );
643 };
644}
645
646
# spent 393µs (133+259) within Moose::Exporter::import which was called 3 times, avg 131µs/call: # once (50µs+91µs) by Moose::BEGIN@15 at line 15 of Moose.pm # once (41µs+89µs) by Moose::Role::BEGIN@17 at line 17 of Moose/Role.pm # once (42µs+79µs) by Moose::Util::TypeConstraints::BEGIN@7 at line 7 of Moose/Util/TypeConstraints.pm
sub import {
647334µs343µs strict->import;
# spent 43µs making 3 calls to strict::import, avg 14µs/call
648375µs3216µs warnings->import;
# spent 216µs making 3 calls to warnings::import, avg 72µs/call
649}
650
651125µs1;
652
653__END__
 
# spent 621µs within Moose::Exporter::_export_is_flagged which was called 94 times, avg 7µs/call: # 94 times (621µs+0s) by Moose::Exporter::_remove_keywords at line 580, avg 7µs/call
sub Moose::Exporter::_export_is_flagged; # xsub
# spent 1.36ms within Moose::Exporter::_flag_as_reexport which was called 186 times, avg 7µs/call: # 186 times (1.36ms+0s) by Moose::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Exporter.pm:125] at line 123, avg 7µs/call
sub Moose::Exporter::_flag_as_reexport; # xsub