← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:10 2016

Filename/usr/local/lib/perl/5.18.2/Moose/Exporter.pm
StatementsExecuted 21820 statements in 38.7ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
504114.28ms7.13msMoose::Exporter::::__ANON__[:389]Moose::Exporter::__ANON__[:389]
67114.19ms50.3msMoose::Exporter::::__ANON__[:140]Moose::Exporter::__ANON__[:140]
62114.16ms4.27msMoose::Exporter::::_remove_keywordsMoose::Exporter::_remove_keywords
1113.45ms72.7msMoose::Exporter::::BEGIN@8Moose::Exporter::BEGIN@8
504112.04ms2.04msMoose::Exporter::::_late_curry_wrapperMoose::Exporter::_late_curry_wrapper
67111.01ms1.01msMoose::Exporter::::_collect_metarolesMoose::Exporter::_collect_metaroles
6711703µs2.27msMoose::Exporter::::_apply_metarolesMoose::Exporter::_apply_metaroles
6711701µs978µsMoose::Exporter::::_strip_traitsMoose::Exporter::_strip_traits
111612µs3.74msMoose::Exporter::::BEGIN@10Moose::Exporter::BEGIN@10
14111597µs1.33msMoose::Exporter::::__ANON__[:252]Moose::Exporter::__ANON__[:252]
39411423µs423µsMoose::Exporter::::__ANON__[:317]Moose::Exporter::__ANON__[:317]
6711422µs505µsMoose::Exporter::::_strip_meta_nameMoose::Exporter::_strip_meta_name
6711422µs521µsMoose::Exporter::::_strip_metaclassMoose::Exporter::_strip_metaclass
13421368µs844µsMoose::Exporter::::__ANON__[:39]Moose::Exporter::__ANON__[:39]
311354µs556µsMoose::Exporter::::_make_sub_exporter_paramsMoose::Exporter::_make_sub_exporter_params
6711207µs207µsMoose::Exporter::::_get_callerMoose::Exporter::_get_caller
311186µs2.46msMoose::Exporter::::build_import_methodsMoose::Exporter::build_import_methods
4431120µs120µsMoose::Exporter::::_sub_from_packageMoose::Exporter::_sub_from_package
12411111µs111µsMoose::Exporter::::_flag_as_reexportMoose::Exporter::_flag_as_reexport (xsub)
12211111µs111µsMoose::Exporter::::_export_is_flaggedMoose::Exporter::_export_is_flagged (xsub)
161144µs44µsMoose::Exporter::::_make_wrapped_sub_with_metaMoose::Exporter::_make_wrapped_sub_with_meta
31140µs40µsMoose::Exporter::::_make_init_metaMoose::Exporter::_make_init_meta
33337µs89µsMoose::Exporter::::importMoose::Exporter::import
31135µs115µsMoose::Exporter::::_follow_alsoMoose::Exporter::_follow_also
31134µs1.20msMoose::Exporter::::_make_exporterMoose::Exporter::_make_exporter
33334µs2.50msMoose::Exporter::::setup_import_methodsMoose::Exporter::setup_import_methods
31130µs51µsMoose::Exporter::::_die_if_cycle_found_in_also_list_for_packageMoose::Exporter::_die_if_cycle_found_in_also_list_for_package
281126µs26µsMoose::Exporter::::CORE:matchMoose::Exporter::CORE:match (opcode)
31122µs22µsMoose::Exporter::::_make_import_subMoose::Exporter::_make_import_sub
62115µs15µsMoose::Exporter::::_also_list_for_packageMoose::Exporter::_also_list_for_package
31114µs14µsMoose::Exporter::::_make_unimport_subMoose::Exporter::_make_unimport_sub
11113µs47µsMoose::Exporter::::BEGIN@11Moose::Exporter::BEGIN@11
11113µs26µsMoose::Exporter::::BEGIN@136Moose::Exporter::BEGIN@136
31113µs16µsMoose::Exporter::::_follow_also_realMoose::Exporter::_follow_also_real
31113µs13µsMoose::Exporter::::_parse_trait_aliasesMoose::Exporter::_parse_trait_aliases
11110µs97µsMoose::Exporter::::BEGIN@12Moose::Exporter::BEGIN@12
1119µs47µsMoose::Exporter::::BEGIN@9Moose::Exporter::BEGIN@9
1119µs19µsMoose::Exporter::::BEGIN@4Moose::Exporter::BEGIN@4
1118µs17µsMoose::Exporter::::BEGIN@725Moose::Exporter::BEGIN@725
3118µs8µsMoose::Exporter::::_die_if_also_list_cycles_back_to_existing_stackMoose::Exporter::_die_if_also_list_cycles_back_to_existing_stack
1117µs20µsMoose::Exporter::::BEGIN@135Moose::Exporter::BEGIN@135
1117µs27µsMoose::Exporter::::BEGIN@7Moose::Exporter::BEGIN@7
1117µs16µsMoose::Exporter::::BEGIN@331Moose::Exporter::BEGIN@331
1116µs25µsMoose::Exporter::::BEGIN@13Moose::Exporter::BEGIN@13
1116µs13µsMoose::Exporter::::BEGIN@735Moose::Exporter::BEGIN@735
1116µs9µsMoose::Exporter::::BEGIN@5Moose::Exporter::BEGIN@5
1115µs98µsMoose::Exporter::::BEGIN@15Moose::Exporter::BEGIN@15
0000s0sMoose::Exporter::::__ANON__[:228]Moose::Exporter::__ANON__[:228]
0000s0sMoose::Exporter::::__ANON__[:366]Moose::Exporter::__ANON__[:366]
0000s0sMoose::Exporter::::__ANON__[:398]Moose::Exporter::__ANON__[:398]
0000s0sMoose::Exporter::::__ANON__[:420]Moose::Exporter::__ANON__[:420]
0000s0sMoose::Exporter::::__ANON__[:528]Moose::Exporter::__ANON__[:528]
0000s0sMoose::Exporter::::__ANON__[:532]Moose::Exporter::__ANON__[:532]
0000s0sMoose::Exporter::::__ANON__[:546]Moose::Exporter::__ANON__[:546]
0000s0sMoose::Exporter::::__ANON__[:558]Moose::Exporter::__ANON__[:558]
0000s0sMoose::Exporter::::__ANON__[:715]Moose::Exporter::__ANON__[:715]
0000s0sMoose::Exporter::::__ANON__[:787]Moose::Exporter::__ANON__[:787]
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;
21600nsour $VERSION = '2.1604';
3
4220µs229µs
# spent 19µs (9+10) within Moose::Exporter::BEGIN@4 which was called: # once (9µs+10µs) by Moose::BEGIN@15 at line 4
use strict;
# spent 19µs making 1 call to Moose::Exporter::BEGIN@4 # spent 10µs making 1 call to strict::import
5219µs213µs
# spent 9µs (6+4) within Moose::Exporter::BEGIN@5 which was called: # once (6µs+4µs) by Moose::BEGIN@15 at line 5
use warnings;
# spent 9µs making 1 call to Moose::Exporter::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
7220µs248µs
# spent 27µs (7+20) within Moose::Exporter::BEGIN@7 which was called: # once (7µs+20µs) by Moose::BEGIN@15 at line 7
use Class::Load qw(is_class_loaded);
# spent 27µs making 1 call to Moose::Exporter::BEGIN@7 # spent 20µs making 1 call to Exporter::import
82120µs172.7ms
# spent 72.7ms (3.45+69.3) within Moose::Exporter::BEGIN@8 which was called: # once (3.45ms+69.3ms) by Moose::BEGIN@15 at line 8
use Class::MOP;
# spent 72.7ms making 1 call to Moose::Exporter::BEGIN@8
9225µs285µs
# spent 47µs (9+38) within Moose::Exporter::BEGIN@9 which was called: # once (9µs+38µs) by Moose::BEGIN@15 at line 9
use List::MoreUtils qw( first_index uniq );
# spent 47µs making 1 call to Moose::Exporter::BEGIN@9 # spent 38µs making 1 call to Exporter::import
102140µs13.74ms
# spent 3.74ms (612µs+3.12) within Moose::Exporter::BEGIN@10 which was called: # once (612µs+3.12ms) by Moose::BEGIN@15 at line 10
use Moose::Util::MetaRole;
# spent 3.74ms making 1 call to Moose::Exporter::BEGIN@10
11340µs381µs
# spent 47µs (13+34) within Moose::Exporter::BEGIN@11 which was called: # once (13µs+34µs) by Moose::BEGIN@15 at line 11
use Scalar::Util 1.11 qw(reftype);
# spent 47µs making 1 call to Moose::Exporter::BEGIN@11 # spent 24µs making 1 call to Exporter::import # spent 9µs making 1 call to UNIVERSAL::VERSION
12336µs3185µs
# spent 97µs (10+88) within Moose::Exporter::BEGIN@12 which was called: # once (10µs+88µs) by Moose::BEGIN@15 at line 12
use Sub::Exporter 0.980;
# spent 97µs making 1 call to Moose::Exporter::BEGIN@12 # spent 80µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] # spent 8µs making 1 call to UNIVERSAL::VERSION
13221µs243µs
# spent 25µs (6+18) within Moose::Exporter::BEGIN@13 which was called: # once (6µs+18µs) by Moose::BEGIN@15 at line 13
use Sub::Name qw(subname);
# spent 25µs making 1 call to Moose::Exporter::BEGIN@13 # spent 18µs making 1 call to Exporter::import
14
152357µs2190µs
# spent 98µs (5+92) within Moose::Exporter::BEGIN@15 which was called: # once (5µs+92µs) by Moose::BEGIN@15 at line 15
use Moose::Util 'throw_exception';
# spent 98µs making 1 call to Moose::Exporter::BEGIN@15 # spent 92µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
16
171200nsmy %EXPORT_SPEC;
18
19
# spent 2.50ms (34µs+2.46) within Moose::Exporter::setup_import_methods which was called 3 times, avg 833µs/call: # once (13µs+946µs) by Moose::Meta::Attribute::BEGIN@16 at line 38 of Moose/Util/TypeConstraints.pm # once (10µs+761µs) by PONAPI::Builder::BEGIN@4 at line 94 of Moose/Role.pm # once (11µs+758µs) by PONAPI::Server::ConfigReader::BEGIN@4 at line 132 of Moose.pm
sub setup_import_methods {
2036µs my ( $class, %args ) = @_;
21
2235µs $args{exporting_package} ||= caller();
23
24324µs32.46ms $class->build_import_methods(
# spent 2.46ms making 3 calls to Moose::Exporter::build_import_methods, avg 822µs/call
25 %args,
26 install => [qw(import unimport init_meta)]
27 );
28}
29
30# A reminder to intrepid Moose hackers
31# there may be more than one level of exporter
32# don't make doy cry. -- perigrin
33
34
# spent 2.46ms (186µs+2.28) within Moose::Exporter::build_import_methods which was called 3 times, avg 822µs/call: # 3 times (186µs+2.28ms) by Moose::Exporter::setup_import_methods at line 24, avg 822µs/call
sub build_import_methods {
3535µs my ( $class, %args ) = @_;
36
3733µs my $exporting_package = $args{exporting_package} ||= caller();
38
39137338µs134476µs
# spent 844µs (368+476) within Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:39] which was called 134 times, avg 6µs/call: # 67 times (228µs+242µs) by Moose::Exporter::_apply_metaroles at line 575, avg 7µs/call # 67 times (140µs+233µs) by Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:140] at line 111, avg 6µs/call
my $meta_lookup = $args{meta_lookup} || sub { Class::MOP::class_of(shift) };
# spent 476µs making 134 calls to Class::MOP::class_of, avg 4µs/call
40
4133µs $EXPORT_SPEC{$exporting_package} = \%args;
42
4339µs3115µs my @exports_from = $class->_follow_also($exporting_package);
# spent 115µs making 3 calls to Moose::Exporter::_follow_also, avg 38µs/call
44
4532µs my $export_recorder = {};
4631µs my $is_reexport = {};
47
48314µs3556µs my $exports = $class->_make_sub_exporter_params(
# spent 556µs making 3 calls to Moose::Exporter::_make_sub_exporter_params, avg 185µs/call
49 [ $exporting_package, @exports_from ],
50 $export_recorder,
51 $is_reexport,
52 $args{meta_lookup}, # so that we don't pass through the default
53 );
54
55311µs31.20ms my $exporter = $class->_make_exporter(
# spent 1.20ms making 3 calls to Moose::Exporter::_make_exporter, avg 401µs/call
56 $exports,
57 $is_reexport,
58 $meta_lookup,
59 );
60
613600ns my %methods;
62312µs322µs $methods{import} = $class->_make_import_sub(
# spent 22µs making 3 calls to Moose::Exporter::_make_import_sub, avg 7µs/call
63 $exporting_package,
64 $exporter,
65 \@exports_from,
66 $is_reexport,
67 $meta_lookup,
68 );
69
7039µs314µs $methods{unimport} = $class->_make_unimport_sub(
# spent 14µs making 3 calls to Moose::Exporter::_make_unimport_sub, avg 5µs/call
71 $exporting_package,
72 $exports,
73 $export_recorder,
74 $is_reexport,
75 $meta_lookup,
76 );
77
78311µs340µs $methods{init_meta} = $class->_make_init_meta(
# spent 40µs making 3 calls to Moose::Exporter::_make_init_meta, avg 13µs/call
79 $exporting_package,
80 \%args,
81 $meta_lookup,
82 );
83
84310µs387µs my $package = Class::MOP::Package->initialize($exporting_package);
# spent 87µs making 3 calls to Class::MOP::Package::initialize, avg 29µs/call
8536µs for my $to_install ( @{ $args{install} || [] } ) {
8694µs my $symbol = '&' . $to_install;
87
88 next
89913µs6137µs unless $methods{$to_install}
# spent 137µs making 6 calls to Class::MOP::Package::has_package_symbol, avg 23µs/call
90 && !$package->has_package_symbol($symbol);
91646µs12107µs $package->add_package_symbol(
# spent 92µs making 6 calls to Class::MOP::Package::add_package_symbol, avg 15µs/call # spent 15µs making 6 calls to Sub::Name::subname, avg 3µs/call
92 $symbol,
93 subname(
94 $exporting_package . '::' . $to_install, $methods{$to_install}
95 )
96 );
97 }
98
99312µs return ( $methods{import}, $methods{unimport}, $methods{init_meta} );
100}
101
102
# spent 1.20ms (34µs+1.17) within Moose::Exporter::_make_exporter which was called 3 times, avg 401µs/call: # 3 times (34µs+1.17ms) by Moose::Exporter::build_import_methods at line 55, avg 401µs/call
sub _make_exporter {
10332µs my ($class, $exports, $is_reexport, $meta_lookup) = @_;
104
105 return Sub::Exporter::build_exporter(
106 {
107 exports => $exports,
108 groups => { default => [':all'] },
109
# spent 50.3ms (4.19+46.1) within Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:140] which was called 67 times, avg 751µs/call: # 67 times (4.19ms+46.1ms) by Sub::Exporter::_do_import at line 380 of Sub/Exporter.pm, avg 751µs/call
installer => sub {
1106730µs my ($arg, $to_export) = @_;
1116777µs67374µs my $meta = $meta_lookup->($arg->{into});
# spent 374µs making 67 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:39], avg 6µs/call
112
1136727µs2886µs goto &Sub::Exporter::default_installer unless $meta;
# spent 886µs making 2 calls to Sub::Exporter::default_installer, avg 443µs/call
114
115 # don't overwrite existing symbols with our magically flagged
116 # version of it if we would install the same sub that's already
117 # in the importer
118
1196519µs my @filtered_to_export;
1206510µs my %installed;
12165365µs for (my $i = 0; $i < @{ $to_export }; $i += 2) {
122862359µs my ($as, $cv) = @{ $to_export }[$i, $i + 1];
123
124862919µs86417.7ms next if !ref($as)
# spent 17.7ms making 862 calls to Class::MOP::Package::has_package_symbol, avg 21µs/call # spent 12µs making 2 calls to Class::MOP::Package::get_package_symbol, avg 6µs/call
125 && $meta->has_package_symbol('&' . $as)
126 && $meta->get_package_symbol('&' . $as) == $cv;
127
128860260µs push @filtered_to_export, $as, $cv;
129860529µs $installed{$as} = 1 unless ref $as;
130 }
131
13265101µs6527.9ms Sub::Exporter::default_installer($arg, \@filtered_to_export);
# spent 27.9ms making 65 calls to Sub::Exporter::default_installer, avg 429µs/call
133
13465317µs for my $name ( keys %{$is_reexport} ) {
135223µs233µs
# spent 20µs (7+13) within Moose::Exporter::BEGIN@135 which was called: # once (7µs+13µs) by Moose::BEGIN@15 at line 135
no strict 'refs';
# spent 20µs making 1 call to Moose::Exporter::BEGIN@135 # spent 13µs making 1 call to strict::unimport
1362731µs239µs
# spent 26µs (13+13) within Moose::Exporter::BEGIN@136 which was called: # once (13µs+13µs) by Moose::BEGIN@15 at line 136
no warnings 'once';
# spent 26µs making 1 call to Moose::Exporter::BEGIN@136 # spent 13µs making 1 call to warnings::unimport
13712634µs next unless exists $installed{$name};
138124566µs124111µs _flag_as_reexport( \*{ join q{::}, $arg->{into}, $name } );
# spent 111µs making 124 calls to Moose::Exporter::_flag_as_reexport, avg 895ns/call
139 }
140 },
141 }
142333µs31.17ms );
# spent 1.17ms making 3 calls to Sub::Exporter::build_exporter, avg 389µs/call
143}
144
145
# spent 115µs (35+80) within Moose::Exporter::_follow_also which was called 3 times, avg 38µs/call: # 3 times (35µs+80µs) by Moose::Exporter::build_import_methods at line 43, avg 38µs/call
sub _follow_also {
14633µs my $class = shift;
1473800ns my $exporting_package = shift;
148
14936µs351µs _die_if_cycle_found_in_also_list_for_package($exporting_package);
# spent 51µs making 3 calls to Moose::Exporter::_die_if_cycle_found_in_also_list_for_package, avg 17µs/call
150
151333µs629µs return uniq( _follow_also_real($exporting_package) );
# spent 16µs making 3 calls to Moose::Exporter::_follow_also_real, avg 5µs/call # spent 13µs making 3 calls to List::MoreUtils::uniq, avg 4µs/call
152}
153
154
# spent 16µs (13+3) within Moose::Exporter::_follow_also_real which was called 3 times, avg 5µs/call: # 3 times (13µs+3µs) by Moose::Exporter::_follow_also at line 151, avg 5µs/call
sub _follow_also_real {
1553900ns my $exporting_package = shift;
15632µs33µs my @also = _also_list_for_package($exporting_package);
# spent 3µs making 3 calls to Moose::Exporter::_also_list_for_package, avg 1µs/call
157
15838µs return map { $_, _follow_also_real($_) } @also;
159}
160
161
# spent 15µs within Moose::Exporter::_also_list_for_package which was called 6 times, avg 3µs/call: # 3 times (12µs+0s) by Moose::Exporter::_die_if_cycle_found_in_also_list_for_package at line 183, avg 4µs/call # 3 times (3µs+0s) by Moose::Exporter::_follow_also_real at line 156, avg 1µs/call
sub _also_list_for_package {
16262µs my $package = shift;
163
16463µs if ( !exists $EXPORT_SPEC{$package} ) {
165 my $loaded = is_class_loaded($package);
166
167 throw_exception( PackageDoesNotUseMooseExporter => package => $package,
168 is_loaded => $loaded
169 );
170 }
171
17264µs my $also = $EXPORT_SPEC{$package}{also};
173
174622µs return unless defined $also;
175
176 return ref $also ? @$also : $also;
177}
178
179# this is no Tarjan algorithm, but for the list sizes expected,
180# brute force will probably be fine (and more maintainable)
181
# spent 51µs (30+20) within Moose::Exporter::_die_if_cycle_found_in_also_list_for_package which was called 3 times, avg 17µs/call: # 3 times (30µs+20µs) by Moose::Exporter::_follow_also at line 149, avg 17µs/call
sub _die_if_cycle_found_in_also_list_for_package {
1823900ns my $package = shift;
183320µs620µs _die_if_also_list_cycles_back_to_existing_stack(
# spent 12µs making 3 calls to Moose::Exporter::_also_list_for_package, avg 4µs/call # spent 8µs making 3 calls to Moose::Exporter::_die_if_also_list_cycles_back_to_existing_stack, avg 3µs/call
184 [ _also_list_for_package($package) ],
185 [$package],
186 );
187}
188
189
# spent 8µs within Moose::Exporter::_die_if_also_list_cycles_back_to_existing_stack which was called 3 times, avg 3µs/call: # 3 times (8µs+0s) by Moose::Exporter::_die_if_cycle_found_in_also_list_for_package at line 183, avg 3µs/call
sub _die_if_also_list_cycles_back_to_existing_stack {
19031µs my ( $also_list, $existing_stack ) = @_;
191
192310µs return unless @$also_list && @$existing_stack;
193
194 for my $also_member (@$also_list) {
195 for my $stack_member (@$existing_stack) {
196 next unless $also_member eq $stack_member;
197
198 throw_exception( CircularReferenceInAlso => also_parameter => $also_member,
199 stack => $existing_stack
200 );
201 }
202
203 _die_if_also_list_cycles_back_to_existing_stack(
204 [ _also_list_for_package($also_member) ],
205 [ $also_member, @$existing_stack ],
206 );
207 }
208}
209
210
# spent 13µs within Moose::Exporter::_parse_trait_aliases which was called 3 times, avg 4µs/call: # 3 times (13µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 281, avg 4µs/call
sub _parse_trait_aliases {
21131µs my $class = shift;
21232µs my ($package, $aliases) = @_;
213
2143400ns my @ret;
21533µs for my $alias (@$aliases) {
216 my $name;
217 if (ref($alias)) {
218 reftype($alias) eq 'ARRAY'
219 or throw_exception( InvalidArgumentsToTraitAliases => class_name => $class,
220 package_name => $package,
221 alias => $alias
222 );
223 ($alias, $name) = @$alias;
224 }
225 else {
226 ($name = $alias) =~ s/.*:://;
227 }
228 push @ret, subname "${package}::${name}" => sub () { $alias };
229 }
230
23139µs return @ret;
232}
233
234
# spent 556µs (354+202) within Moose::Exporter::_make_sub_exporter_params which was called 3 times, avg 185µs/call: # 3 times (354µs+202µs) by Moose::Exporter::build_import_methods at line 48, avg 185µs/call
sub _make_sub_exporter_params {
2353900ns my $class = shift;
2363900ns my $packages = shift;
2373600ns my $export_recorder = shift;
2383400ns my $is_reexport = shift;
23933µs my $meta_lookup_override = shift;
240
2413700ns my %exports;
2423500ns my $current_meta_lookup;
243
24434µs for my $package ( @{$packages} ) {
24531µs my $args = $EXPORT_SPEC{$package}
246 or die "The $package package does not use Moose::Exporter\n";
247
24833µs $current_meta_lookup = $meta_lookup_override || $args->{meta_lookup};
2493500ns $meta_lookup_override = $current_meta_lookup;
250
251 my $meta_lookup = $current_meta_lookup
252144640µs141734µs
# spent 1.33ms (597µs+734µs) within Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:252] which was called 141 times, avg 9µs/call: # 141 times (597µs+734µs) by 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::extends or Moose::has or Moose::override or Moose::with at line 418, avg 9µs/call
|| sub { Class::MOP::class_of(shift) };
# spent 734µs making 141 calls to Class::MOP::class_of, avg 5µs/call
253
25434µs for my $name ( @{ $args->{with_meta} } ) {
2551618µs1641µs my $sub = $class->_sub_from_package( $package, $name )
# spent 41µs making 16 calls to Moose::Exporter::_sub_from_package, avg 3µs/call
256 or next;
257
258167µs my $fq_name = $package . '::' . $name;
259
2601631µs1644µs $exports{$name} = $class->_make_wrapped_sub_with_meta(
# spent 44µs making 16 calls to Moose::Exporter::_make_wrapped_sub_with_meta, avg 3µs/call
261 $fq_name,
262 $sub,
263 $export_recorder,
264 $meta_lookup,
265 ) unless exists $exports{$name};
266 }
267
26834µs for my $name ( @{ $args->{with_caller} } ) {
269 my $sub = $class->_sub_from_package( $package, $name )
270 or next;
271
272 my $fq_name = $package . '::' . $name;
273
274 $exports{$name} = $class->_make_wrapped_sub(
275 $fq_name,
276 $sub,
277 $export_recorder,
278 ) unless exists $exports{$name};
279 }
280
281310µs313µs my @extra_exports = $class->_parse_trait_aliases(
# spent 13µs making 3 calls to Moose::Exporter::_parse_trait_aliases, avg 4µs/call
282 $package, $args->{trait_aliases},
283 );
28437µs for my $name ( @{ $args->{as_is} }, @extra_exports ) {
285282µs my ( $sub, $coderef_name );
286
2872871µs2826µs if ( ref $name ) {
# spent 26µs making 28 calls to Moose::Exporter::CORE:match, avg 936ns/call
288 $sub = $name;
289
290 my $coderef_pkg;
291 ( $coderef_pkg, $coderef_name )
292 = Class::MOP::get_code_info($name);
293
294 if ( $coderef_pkg ne $package ) {
295 $is_reexport->{$coderef_name} = 1;
296 }
297 }
298 elsif ( $name =~ /^(.*)::([^:]+)$/ ) {
299413µs413µs $sub = $class->_sub_from_package( "$1", "$2" )
# spent 13µs making 4 calls to Moose::Exporter::_sub_from_package, avg 3µs/call
300 or next;
301
30242µs $coderef_name = "$2";
303
30444µs if ( $1 ne $package ) {
305 $is_reexport->{$coderef_name} = 1;
306 }
307 }
308 else {
3092426µs2465µs $sub = $class->_sub_from_package( $package, $name )
# spent 65µs making 24 calls to Moose::Exporter::_sub_from_package, avg 3µs/call
310 or next;
311
312247µs $coderef_name = $name;
313 }
314
3152822µs $export_recorder->{$sub} = 1;
316
317394675µs
# spent 423µs within Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:317] which was called 394 times, avg 1µs/call: # 394 times (423µs+0s) by Sub::Exporter::default_generator at line 419 of Sub/Exporter.pm, avg 1µs/call
$exports{$coderef_name} = sub { $sub }
3182856µs unless exists $exports{$coderef_name};
319 }
320 }
321
32239µs return \%exports;
323}
324
325
# spent 120µs within Moose::Exporter::_sub_from_package which was called 44 times, avg 3µs/call: # 24 times (65µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 309, avg 3µs/call # 16 times (41µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 255, avg 3µs/call # 4 times (13µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 299, avg 3µs/call
sub _sub_from_package {
326449µs my $sclass = shift;
327445µs my $package = shift;
328446µs my $name = shift;
329
3304412µs my $sub = do {
33121.33ms225µs
# spent 16µs (7+9) within Moose::Exporter::BEGIN@331 which was called: # once (7µs+9µs) by Moose::BEGIN@15 at line 331
no strict 'refs';
# spent 16µs making 1 call to Moose::Exporter::BEGIN@331 # spent 9µs making 1 call to strict::unimport
3324448µs \&{ $package . '::' . $name };
333 };
334
3354483µs return $sub if defined &$sub;
336
337 Carp::cluck "Trying to export undefined sub ${package}::${name}";
338
339 return;
340}
341
34210sour $CALLER;
343
344sub _make_wrapped_sub {
345 my $self = shift;
346 my $fq_name = shift;
347 my $sub = shift;
348 my $export_recorder = shift;
349
350 # We need to set the package at import time, so that when
351 # package Foo imports has(), we capture "Foo" as the
352 # package. This lets other packages call Foo::has() and get
353 # the right package. This is done for backwards compatibility
354 # with existing production code, not because this is a good
355 # idea ;)
356 return sub {
357 my $caller = $CALLER;
358
359 my $wrapper = $self->_curry_wrapper( $sub, $fq_name, $caller );
360
361 my $sub = subname( $fq_name => $wrapper );
362
363 $export_recorder->{$sub} = 1;
364
365 return $sub;
366 };
367}
368
369
# spent 44µs within Moose::Exporter::_make_wrapped_sub_with_meta which was called 16 times, avg 3µs/call: # 16 times (44µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 260, avg 3µs/call
sub _make_wrapped_sub_with_meta {
370164µs my $self = shift;
371163µs my $fq_name = shift;
372162µs my $sub = shift;
373161µs my $export_recorder = shift;
374162µs my $meta_lookup = shift;
375
376
# spent 7.13ms (4.28+2.86) within Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:389] which was called 504 times, avg 14µs/call: # 504 times (4.28ms+2.86ms) by Sub::Exporter::default_generator at line 419 of Sub/Exporter.pm, avg 14µs/call
return sub {
377504100µs my $caller = $CALLER;
378
379504565µs5042.04ms my $wrapper = $self->_late_curry_wrapper(
# spent 2.04ms making 504 calls to Moose::Exporter::_late_curry_wrapper, avg 4µs/call
380 $sub, $fq_name,
381 $meta_lookup => $caller
382 );
383
3845041.61ms504822µs my $sub = subname( $fq_name => $wrapper );
# spent 822µs making 504 calls to Sub::Name::subname, avg 2µs/call
385
3865041.63ms $export_recorder->{$sub} = 1;
387
3885044.69ms return $sub;
3891650µs };
390}
391
392sub _curry_wrapper {
393 my $class = shift;
394 my $sub = shift;
395 my $fq_name = shift;
396 my @extra = @_;
397
398 my $wrapper = sub { $sub->( @extra, @_ ) };
399 if ( my $proto = prototype $sub ) {
400
401 # XXX - Perl's prototype sucks. Use & to make set_prototype
402 # ignore the fact that we're passing "private variables"
403 &Scalar::Util::set_prototype( $wrapper, $proto );
404 }
405 return $wrapper;
406}
407
408
# spent 2.04ms within Moose::Exporter::_late_curry_wrapper which was called 504 times, avg 4µs/call: # 504 times (2.04ms+0s) by Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:389] at line 379, avg 4µs/call
sub _late_curry_wrapper {
409504101µs my $class = shift;
41050493µs my $sub = shift;
411504106µs my $fq_name = shift;
41250451µs my $extra = shift;
413504187µs my @ex_args = @_;
414
415 my $wrapper = sub {
416
417 # resolve curried arguments at runtime via this closure
418141354µs1411.33ms my @curry = ( $extra->(@ex_args) );
# spent 1.33ms making 141 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:252], avg 9µs/call
419141665µs1411.62s return $sub->( @curry, @_ );
# spent 591ms making 14 calls to Moose::extends, avg 42.2ms/call # spent 555ms making 18 calls to Moose::with, avg 30.8ms/call, recursion: max depth 1, sum of overlapping time 7.62ms # spent 375ms making 47 calls to Moose::has, avg 7.99ms/call # spent 142ms making 14 calls to Moose::Role::with, avg 10.2ms/call, recursion: max depth 2, sum of overlapping time 40.5ms # spent 1.57ms making 15 calls to Moose::Role::has, avg 105µs/call # spent 642µs making 20 calls to Moose::Role::requires, avg 32µs/call # spent 296µs making 1 call to Moose::override # spent 210µs making 7 calls to Moose::Role::around, avg 30µs/call # spent 97µs making 3 calls to Moose::Role::override, avg 32µs/call # spent 59µs making 2 calls to Moose::Role::before, avg 30µs/call
420504909µs };
421
422504156µs if ( my $proto = prototype $sub ) {
423
424 # XXX - Perl's prototype sucks. Use & to make set_prototype
425 # ignore the fact that we're passing "private variables"
426 &Scalar::Util::set_prototype( $wrapper, $proto );
427 }
4285041.02ms return $wrapper;
429}
430
431
# spent 22µs within Moose::Exporter::_make_import_sub which was called 3 times, avg 7µs/call: # 3 times (22µs+0s) by Moose::Exporter::build_import_methods at line 62, avg 7µs/call
sub _make_import_sub {
4323500ns shift;
4333900ns my $exporting_package = shift;
4343600ns my $exporter = shift;
4353600ns my $exports_from = shift;
4363600ns my $is_reexport = shift;
4373700ns my $meta_lookup = shift;
438
439 return sub {
440
441 # I think we could use Sub::Exporter's collector feature
442 # to do this, but that would be rather gross, since that
443 # feature isn't really designed to return a value to the
444 # caller of the exporter sub.
445 #
446 # Also, this makes sure we preserve backwards compat for
447 # _get_caller, so it always sees the arguments in the
448 # expected order.
4496716µs my $traits;
45067213µs67978µs ( $traits, @_ ) = _strip_traits(@_);
# spent 978µs making 67 calls to Moose::Exporter::_strip_traits, avg 15µs/call
451
4526713µs my $metaclass;
45367160µs67521µs ( $metaclass, @_ ) = _strip_metaclass(@_);
# spent 521µs making 67 calls to Moose::Exporter::_strip_metaclass, avg 8µs/call
4546725µs $metaclass
455 = Moose::Util::resolve_metaclass_alias( 'Class' => $metaclass )
456 if defined $metaclass && length $metaclass;
457
4586716µs my $meta_name;
45967175µs67505µs ( $meta_name, @_ ) = _strip_meta_name(@_);
# spent 505µs making 67 calls to Moose::Exporter::_strip_meta_name, avg 8µs/call
460
461 # Normally we could look at $_[0], but in some weird cases
462 # (involving goto &Moose::import), $_[0] ends as something
463 # else (like Squirrel).
4646726µs my $class = $exporting_package;
465
46667117µs67207µs $CALLER = _get_caller(@_);
# spent 207µs making 67 calls to Moose::Exporter::_get_caller, avg 3µs/call
467
468 # this works because both pragmas set $^H (see perldoc
469 # perlvar) which affects the current compilation -
470 # i.e. the file who use'd us - which is why we don't need
471 # to do anything special to make it affect that file
472 # rather than this one (which is already compiled)
473
47467133µs67744µs strict->import;
# spent 744µs making 67 calls to strict::import, avg 11µs/call
47567131µs67413µs warnings->import;
# spent 413µs making 67 calls to warnings::import, avg 6µs/call
476
477679µs my $did_init_meta;
478134471µs67142µs for my $c ( grep { $_->can('init_meta') } $class, @{$exports_from} ) {
# spent 142µs making 67 calls to UNIVERSAL::can, avg 2µs/call
479
480 # init_meta can apply a role, which when loaded uses
481 # Moose::Exporter, which in turn sets $CALLER, so we need
482 # to protect against that.
4836326µs local $CALLER = $CALLER;
48463100µs63121ms $c->init_meta(
# spent 74.3ms making 28 calls to Moose::init_meta, avg 2.65ms/call # spent 46.9ms making 35 calls to Moose::Role::init_meta, avg 1.34ms/call
485 for_class => $CALLER,
486 metaclass => $metaclass,
487 meta_name => $meta_name,
488 );
4896380µs $did_init_meta = 1;
490 }
491
492 {
493 # The metaroles will use Moose::Role, which in turn uses
494 # Moose::Exporter, which in turn sets $CALLER, so we need
495 # to protect against that.
49613466µs local $CALLER = $CALLER;
49767144µs672.27ms _apply_metaroles(
# spent 2.27ms making 67 calls to Moose::Exporter::_apply_metaroles, avg 34µs/call
498 $CALLER,
499 [$class, @$exports_from],
500 $meta_lookup
501 );
502 }
503
5046770µs if ( $did_init_meta && @{$traits} ) {
505
506 # The traits will use Moose::Role, which in turn uses
507 # Moose::Exporter, which in turn sets $CALLER, so we need
508 # to protect against that.
509 local $CALLER = $CALLER;
510 _apply_meta_traits( $CALLER, $traits, $meta_lookup );
511 }
512 elsif ( @{$traits} ) {
513 throw_exception( ClassDoesNotHaveInitMeta => class_name => $class,
514 traits => $traits
515 );
516 }
517
5186761µs my ( undef, @args ) = @_;
5196733µs my $extra = shift @args if ref $args[0] eq 'HASH';
520
5216719µs $extra ||= {};
5226755µs if ( !$extra->{into} ) {
5236756µs $extra->{into_level} ||= 0;
5246731µs $extra->{into_level}++;
525 }
526
52767424µs6792.0ms $class->$exporter( $extra, @args );
# spent 92.0ms making 67 calls to Sub::Exporter::__ANON__[Sub/Exporter.pm:337], avg 1.37ms/call
528319µs };
529}
530
531
# spent 978µs (701+277) within Moose::Exporter::_strip_traits which was called 67 times, avg 15µs/call: # 67 times (701µs+277µs) by Moose::Role::import or Moose::Util::TypeConstraints::import or Moose::import at line 450, avg 15µs/call
sub _strip_traits {
532134765µs67277µs my $idx = first_index { ( $_ || '' ) eq '-traits' } @_;
# spent 277µs making 67 calls to List::MoreUtils::firstidx, avg 4µs/call
533
53467250µs return ( [], @_ ) unless $idx >= 0 && $#_ >= $idx + 1;
535
536 my $traits = $_[ $idx + 1 ];
537
538 splice @_, $idx, 2;
539
540 $traits = [$traits] unless ref $traits;
541
542 return ( $traits, @_ );
543}
544
545
# spent 521µs (422+99) within Moose::Exporter::_strip_metaclass which was called 67 times, avg 8µs/call: # 67 times (422µs+99µs) by Moose::Role::import or Moose::Util::TypeConstraints::import or Moose::import at line 453, avg 8µs/call
sub _strip_metaclass {
546134380µs6799µs my $idx = first_index { ( $_ || '' ) eq '-metaclass' } @_;
# spent 99µs making 67 calls to List::MoreUtils::firstidx, avg 1µs/call
547
548675.42ms return ( undef, @_ ) unless $idx >= 0 && $#_ >= $idx + 1;
549
550 my $metaclass = $_[ $idx + 1 ];
551
552 splice @_, $idx, 2;
553
554 return ( $metaclass, @_ );
555}
556
557
# spent 505µs (422+83) within Moose::Exporter::_strip_meta_name which was called 67 times, avg 8µs/call: # 67 times (422µs+83µs) by Moose::Role::import or Moose::Util::TypeConstraints::import or Moose::import at line 459, avg 8µs/call
sub _strip_meta_name {
558134359µs6783µs my $idx = first_index { ( $_ || '' ) eq '-meta_name' } @_;
# spent 83µs making 67 calls to List::MoreUtils::firstidx, avg 1µs/call
559
56067191µs return ( 'meta', @_ ) unless $idx >= 0 && $#_ >= $idx + 1;
561
562 my $meta_name = $_[ $idx + 1 ];
563
564 splice @_, $idx, 2;
565
566 return ( $meta_name, @_ );
567}
568
569
# spent 2.27ms (703µs+1.57) within Moose::Exporter::_apply_metaroles which was called 67 times, avg 34µs/call: # 67 times (703µs+1.57ms) by Moose::Role::import or Moose::Util::TypeConstraints::import or Moose::import at line 497, avg 34µs/call
sub _apply_metaroles {
5706732µs my ($class, $exports_from, $meta_lookup) = @_;
571
57267109µs671.01ms my $metaroles = _collect_metaroles($exports_from);
# spent 1.01ms making 67 calls to Moose::Exporter::_collect_metaroles, avg 15µs/call
5736736µs my $base_class_roles = delete $metaroles->{base_class_roles};
574
57567113µs67470µs my $meta = $meta_lookup->($class);
# spent 470µs making 67 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:39], avg 7µs/call
576 # for instance, Moose.pm uses Moose::Util::TypeConstraints
5776727µs return unless $meta;
578
5796538µs Moose::Util::MetaRole::apply_metaroles(
580 for => $meta,
581 %$metaroles,
582 ) if keys %$metaroles;
583
58465363µs6587µs Moose::Util::MetaRole::apply_base_class_roles(
# spent 87µs making 65 calls to UNIVERSAL::isa, avg 1µs/call
585 for => $meta,
586 roles => $base_class_roles,
587 ) if $meta->isa('Class::MOP::Class')
588 && $base_class_roles && @$base_class_roles;
589}
590
591
# spent 1.01ms within Moose::Exporter::_collect_metaroles which was called 67 times, avg 15µs/call: # 67 times (1.01ms+0s) by Moose::Exporter::_apply_metaroles at line 572, avg 15µs/call
sub _collect_metaroles {
5926716µs my ($exports_from) = @_;
593
59467264µs my @old_style_role_types = map { "${_}_roles" } qw(
595 metaclass
596 attribute_metaclass
597 method_metaclass
598 wrapped_method_metaclass
599 instance_metaclass
600 constructor_class
601 destructor_class
602 error_class
603 );
604
6056717µs my %class_metaroles;
6066712µs my %role_metaroles;
6076711µs my @base_class_roles;
6086712µs my %old_style_roles;
609
6106764µs for my $exporter (@$exports_from) {
6116756µs my $data = $EXPORT_SPEC{$exporter};
612
6136742µs if (exists $data->{class_metaroles}) {
614 for my $type (keys %{ $data->{class_metaroles} }) {
615 push @{ $class_metaroles{$type} ||= [] },
616 @{ $data->{class_metaroles}{$type} };
617 }
618 }
619
6206738µs if (exists $data->{role_metaroles}) {
621 for my $type (keys %{ $data->{role_metaroles} }) {
622 push @{ $role_metaroles{$type} ||= [] },
623 @{ $data->{role_metaroles}{$type} };
624 }
625 }
626
6276726µs if (exists $data->{base_class_roles}) {
628 push @base_class_roles, @{ $data->{base_class_roles} };
629 }
630
6316765µs for my $type (@old_style_role_types) {
632536187µs if (exists $data->{$type}) {
633 push @{ $old_style_roles{$type} ||= [] },
634 @{ $data->{$type} };
635 }
636 }
637 }
638
639 return {
64067271µs (keys(%class_metaroles)
641 ? (class_metaroles => \%class_metaroles)
642 : ()),
643 (keys(%role_metaroles)
644 ? (role_metaroles => \%role_metaroles)
645 : ()),
646 (@base_class_roles
647 ? (base_class_roles => \@base_class_roles)
648 : ()),
649 %old_style_roles,
650 };
651}
652
653sub _apply_meta_traits {
654 my ( $class, $traits, $meta_lookup ) = @_;
655
656 return unless @{$traits};
657
658 my $meta = $meta_lookup->($class);
659
660 my $type = $meta->isa('Moose::Meta::Role') ? 'Role'
661 : $meta->isa('Class::MOP::Class') ? 'Class'
662 : confess('Cannot determine metaclass type for '
663 . 'trait application. Meta isa '
664 . ref $meta);
665
666 my @resolved_traits = map {
667 ref $_
668 ? $_
669 : Moose::Util::resolve_metatrait_alias( $type => $_ )
670 } @$traits;
671
672 return unless @resolved_traits;
673
674 my %args = ( for => $class );
675
676 if ( $meta->isa('Moose::Meta::Role') ) {
677 $args{role_metaroles} = { role => \@resolved_traits };
678 }
679 else {
680 $args{class_metaroles} = { class => \@resolved_traits };
681 }
682
683 Moose::Util::MetaRole::apply_metaroles(%args);
684}
685
686
# spent 207µs within Moose::Exporter::_get_caller which was called 67 times, avg 3µs/call: # 67 times (207µs+0s) by Moose::Role::import or Moose::Util::TypeConstraints::import or Moose::import at line 466, avg 3µs/call
sub _get_caller {
687
688 # 1 extra level because it's called by import so there's a layer
689 # of indirection
6906726µs my $offset = 1;
691
692 return
69367231µs ( ref $_[1] && defined $_[1]->{into} ) ? $_[1]->{into}
694 : ( ref $_[1] && defined $_[1]->{into_level} )
695 ? caller( $offset + $_[1]->{into_level} )
696 : caller($offset);
697}
698
699
# spent 14µs within Moose::Exporter::_make_unimport_sub which was called 3 times, avg 5µs/call: # 3 times (14µs+0s) by Moose::Exporter::build_import_methods at line 70, avg 5µs/call
sub _make_unimport_sub {
7003600ns shift;
70131µs my $exporting_package = shift;
7023700ns my $exports = shift;
7033600ns my $export_recorder = shift;
7043600ns my $is_reexport = shift;
7053500ns my $meta_lookup = shift;
706
707 return sub {
7086254µs my $caller = scalar caller();
709 Moose::Exporter->_remove_keywords(
710 $caller,
71162541µs624.27ms [ keys %{$exports} ],
# spent 4.27ms making 62 calls to Moose::Exporter::_remove_keywords, avg 69µs/call
712 $export_recorder,
713 $is_reexport,
714 );
715312µs };
716}
717
718
# spent 4.27ms (4.16+111µs) within Moose::Exporter::_remove_keywords which was called 62 times, avg 69µs/call: # 62 times (4.16ms+111µs) by Moose::Role::unimport or Moose::Util::TypeConstraints::unimport or Moose::unimport at line 711, avg 69µs/call
sub _remove_keywords {
7196212µs shift;
7206218µs my $package = shift;
7216219µs my $keywords = shift;
7226211µs my $recorded_exports = shift;
7236212µs my $is_reexport = shift;
724
725253µs226µs
# spent 17µs (8+9) within Moose::Exporter::BEGIN@725 which was called: # once (8µs+9µs) by Moose::BEGIN@15 at line 725
no strict 'refs';
# spent 17µs making 1 call to Moose::Exporter::BEGIN@725 # spent 9µs making 1 call to strict::unimport
726
72762215µs foreach my $name ( @{$keywords} ) {
728816906µs if ( defined &{ $package . '::' . $name } ) {
729816603µs my $sub = \&{ $package . '::' . $name };
730
731 # make sure it is from us
732816348µs next unless $recorded_exports->{$sub};
733
734816124µs if ( $is_reexport->{$name} ) {
7352249µs220µs
# spent 13µs (6+7) within Moose::Exporter::BEGIN@735 which was called: # once (6µs+7µs) by Moose::BEGIN@15 at line 735
no strict 'refs';
# spent 13µs making 1 call to Moose::Exporter::BEGIN@735 # spent 7µs making 1 call to strict::unimport
736 next
737 unless _export_is_flagged(
738122578µs122111µs \*{ join q{::} => $package, $name } );
# spent 111µs making 122 calls to Moose::Exporter::_export_is_flagged, avg 908ns/call
739 }
740
741 # and if it is from us, then undef the slot
7428141.49ms delete ${ $package . '::' }{$name};
743 }
744 }
745}
746
747# maintain this for now for backcompat
748# make sure to return a sub to install in the same circumstances as previously
749# but this functionality now happens at the end of ->import
750
# spent 40µs within Moose::Exporter::_make_init_meta which was called 3 times, avg 13µs/call: # 3 times (40µs+0s) by Moose::Exporter::build_import_methods at line 78, avg 13µs/call
sub _make_init_meta {
7513300ns shift;
7523800ns my $class = shift;
7533700ns my $args = shift;
7543500ns my $meta_lookup = shift;
755
75632µs my %old_style_roles;
757313µs for my $role (
758 map {"${_}_roles"}
759 qw(
760 metaclass
761 attribute_metaclass
762 method_metaclass
763 wrapped_method_metaclass
764 instance_metaclass
765 constructor_class
766 destructor_class
767 error_class
768 )
769 ) {
770248µs $old_style_roles{$role} = $args->{$role}
771 if exists $args->{$role};
772 }
773
7743500ns my %base_class_roles;
77532µs %base_class_roles = ( roles => $args->{base_class_roles} )
776 if exists $args->{base_class_roles};
777
778 my %new_style_roles = map { $_ => $args->{$_} }
77936µs grep { exists $args->{$_} } qw( class_metaroles role_metaroles );
780
781310µs return unless %new_style_roles || %old_style_roles || %base_class_roles;
782
783 return sub {
784 shift;
785 my %opts = @_;
786 $meta_lookup->($opts{for_class});
787 };
788}
789
790
# spent 89µs (37+52) within Moose::Exporter::import which was called 3 times, avg 30µs/call: # once (21µs+28µs) by Moose::BEGIN@15 at line 15 of Moose.pm # once (7µs+14µs) by Moose::Role::BEGIN@16 at line 16 of Moose/Role.pm # once (9µs+10µs) by Moose::Util::TypeConstraints::BEGIN@6 at line 6 of Moose/Util/TypeConstraints.pm
sub import {
79134µs326µs strict->import;
# spent 26µs making 3 calls to strict::import, avg 9µs/call
792313µs326µs warnings->import;
# spent 26µs making 3 calls to warnings::import, avg 9µs/call
793}
794
79513µs1;
796
797# ABSTRACT: make an import() and unimport() just like Moose.pm
798
799__END__
 
# spent 26µs within Moose::Exporter::CORE:match which was called 28 times, avg 936ns/call: # 28 times (26µs+0s) by Moose::Exporter::_make_sub_exporter_params at line 287, avg 936ns/call
sub Moose::Exporter::CORE:match; # opcode
# spent 111µs within Moose::Exporter::_export_is_flagged which was called 122 times, avg 908ns/call: # 122 times (111µs+0s) by Moose::Exporter::_remove_keywords at line 738, avg 908ns/call
sub Moose::Exporter::_export_is_flagged; # xsub
# spent 111µs within Moose::Exporter::_flag_as_reexport which was called 124 times, avg 895ns/call: # 124 times (111µs+0s) by Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:140] at line 138, avg 895ns/call
sub Moose::Exporter::_flag_as_reexport; # xsub