Profile of Sub/Exporter.pm

← 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:09 2016

Filename | /usr/local/share/perl/5.18.2/Sub/Exporter.pm
Statements | Executed 27053 statements in 29.9ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
941 | 1 | 1 | 8.23ms | 17.0ms | Sub::Exporter::::default_generatorSub::Exporter::default_generator
118 | 1 | 1 | 6.17ms | 76.4ms | Sub::Exporter::::_do_importSub::Exporter::_do_import
258 | 2 | 1 | 4.52ms | 16.7ms | Sub::Exporter::::_expand_groupsSub::Exporter::_expand_groups (recurses: max depth 2, inclusive time 15.9ms)
118 | 3 | 2 | 3.99ms | 30.8ms | Sub::Exporter::::default_installerSub::Exporter::default_installer
118 | 52 | 48 | 2.68ms | 100ms | Sub::Exporter::::__ANON__[:337]Sub::Exporter::__ANON__[:337]
140 | 1 | 1 | 2.08ms | 15.0ms | Sub::Exporter::::_expand_groupSub::Exporter::_expand_group (recurses: max depth 1, inclusive time 11.8ms)
118 | 1 | 1 | 1.84ms | 3.34ms | Sub::Exporter::::_collect_collectionsSub::Exporter::_collect_collections
1221 | 2 | 1 | 1.46ms | 1.46ms | Sub::Exporter::::_group_nameSub::Exporter::_group_name
118 | 1 | 1 | 700µs | 700µs | Sub::Exporter::::_mk_collection_builderSub::Exporter::_mk_collection_builder
11 | 1 | 1 | 320µs | 2.30ms | Sub::Exporter::::_rewrite_build_configSub::Exporter::_rewrite_build_config
10 | 1 | 1 | 147µs | 802µs | Sub::Exporter::::__ANON__[:159]Sub::Exporter::__ANON__[:159]
11 | 3 | 2 | 85µs | 2.38ms | Sub::Exporter::::build_exporterSub::Exporter::build_exporter
11 | 1 | 1 | 79µs | 79µs | Sub::Exporter::::_key_intersectionSub::Exporter::_key_intersection
11 | 1 | 1 | 48µs | 57µs | Sub::Exporter::::_assert_collector_names_okSub::Exporter::_assert_collector_names_ok
6 | 1 | 1 | 34µs | 34µs | Sub::Exporter::::_setupSub::Exporter::_setup
2 | 2 | 2 | 26µs | 572µs | Sub::Exporter::::setup_exporterSub::Exporter::setup_exporter
6 | 1 | 1 | 20µs | 791µs | Sub::Exporter::::__ANON__[:460]Sub::Exporter::__ANON__[:460]
1 | 1 | 1 | 11µs | 11µs | App::Cmd::::BEGIN@1.2 App::Cmd::BEGIN@1.2
7 | 1 | 1 | 9µs | 9µs | Sub::Exporter::::CORE:matchSub::Exporter::CORE:match (opcode)
1 | 1 | 1 | 9µs | 9µs | Sub::Exporter::::BEGIN@217Sub::Exporter::BEGIN@217
1 | 1 | 1 | 9µs | 19µs | Sub::Exporter::::BEGIN@12Sub::Exporter::BEGIN@12
1 | 1 | 1 | 8µs | 15µs | Sub::Exporter::::BEGIN@11Sub::Exporter::BEGIN@11
1 | 1 | 1 | 6µs | 12µs | Sub::Exporter::::BEGIN@13Sub::Exporter::BEGIN@13
1 | 1 | 1 | 6µs | 9µs | App::Cmd::::BEGIN@3 App::Cmd::BEGIN@3
1 | 1 | 1 | 5µs | 14µs | App::Cmd::::BEGIN@2.3 App::Cmd::BEGIN@2.3
1 | 1 | 1 | 3µs | 3µs | Sub::Exporter::::BEGIN@10Sub::Exporter::BEGIN@10
0 | 0 | 0 | 0s | 0s | Sub::Exporter::::__ANON__[:354]Sub::Exporter::__ANON__[:354]
0 | 0 | 0 | 0s | 0s | Sub::Exporter::::default_exporterSub::Exporter::default_exporter

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 | 2 | 40µs | 1 | 11µs | # spent 11µs within App::Cmd::BEGIN@1.2 which was called: # once (11µs+0s) by App::Cmd::BEGIN@15 at line 1 use 5.006; # spent 11µs making 1 call to App::Cmd::BEGIN@1.2
2 | 2 | 17µs | 2 | 23µs | # spent 14µs (5+9) within App::Cmd::BEGIN@2.3 which was called: # once (5µs+9µs) by App::Cmd::BEGIN@15 at line 2 use strict; # spent 14µs making 1 call to App::Cmd::BEGIN@2.3 # spent 9µs making 1 call to strict::import
3 | 2 | 32µs | 2 | 12µs | # spent 9µs (6+3) within App::Cmd::BEGIN@3 which was called: # once (6µs+3µs) by App::Cmd::BEGIN@15 at line 3 use warnings; # spent 9µs making 1 call to App::Cmd::BEGIN@3 # spent 3µs making 1 call to warnings::import
4 |  |  |  |  | package Sub::Exporter;
5 |  |  |  |  | {
6 | 2 | 900ns |  |  | $Sub::Exporter::VERSION = '0.987';
7 |  |  |  |  | }
8 |  |  |  |  | # ABSTRACT: a sophisticated exporter for custom-built routines
9 |  |  |  |  |
10 | 2 | 19µs | 1 | 3µs | # spent 3µs within Sub::Exporter::BEGIN@10 which was called: # once (3µs+0s) by App::Cmd::BEGIN@15 at line 10 use Carp (); # spent 3µs making 1 call to Sub::Exporter::BEGIN@10
11 | 3 | 31µs | 2 | 21µs | # spent 15µs (8+7) within Sub::Exporter::BEGIN@11 which was called: # once (8µs+7µs) by App::Cmd::BEGIN@15 at line 11 use Data::OptList 0.100 (); # spent 15µs making 1 call to Sub::Exporter::BEGIN@11 # spent 6µs making 1 call to UNIVERSAL::VERSION
12 | 3 | 35µs | 2 | 30µs | # spent 19µs (9+11) within Sub::Exporter::BEGIN@12 which was called: # once (9µs+11µs) by App::Cmd::BEGIN@15 at line 12 use Params::Util 0.14 (); # _CODELIKE # spent 19µs making 1 call to Sub::Exporter::BEGIN@12 # spent 11µs making 1 call to UNIVERSAL::VERSION
13 | 3 | 802µs | 2 | 17µs | # spent 12µs (6+5) within Sub::Exporter::BEGIN@13 which was called: # once (6µs+5µs) by App::Cmd::BEGIN@15 at line 13 use Sub::Install 0.92 (); # spent 12µs making 1 call to Sub::Exporter::BEGIN@13 # spent 5µs making 1 call to UNIVERSAL::VERSION
14 |  |  |  |  |
15 |  |  |  |  |
16 |  |  |  |  | # Given a potential import name, this returns the group name -- if it's got a
17 |  |  |  |  | # group prefix.
18 |  |  |  |  | # spent 1.46ms within Sub::Exporter::_group_name which was called 1221 times, avg 1µs/call: # 1081 times (1.29ms+0s) by Sub::Exporter::_expand_groups at line 36, avg 1µs/call # 140 times (169µs+0s) by Sub::Exporter::_expand_group at line 76, avg 1µs/call sub _group_name {
19 | 1221 | 247µs |  |  | my ($name) = @_;
20 |  |  |  |  |
21 | 1221 | 1.75ms |  |  | return if (index q{-:}, (substr $name, 0, 1)) == -1;
22 | 280 | 535µs |  |  | return substr $name, 1;
23 |  |  |  |  | }
24 |  |  |  |  |
25 |  |  |  |  | # \@groups is a canonicalized opt list of exports and groups this returns
26 |  |  |  |  | # another canonicalized opt list with groups replaced with relevant exports.
27 |  |  |  |  | # \%seen is groups we've already expanded and can ignore.
28 |  |  |  |  | # \%merge is merged options from the group we're descending through.
29 |  |  |  |  | # spent 16.7ms (4.52+12.2) within Sub::Exporter::_expand_groups which was called 258 times, avg 65µs/call: # 140 times (3.15ms+-3.15ms) by Sub::Exporter::_expand_group at line 124, avg 0s/call # 118 times (1.37ms+15.3ms) by Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:337] at line 323, avg 142µs/call sub _expand_groups {
30 | 258 | 122µs |  |  | my ($class, $config, $groups, $collection, $seen, $merge) = @_;
31 | 258 | 74µs |  |  | $seen ||= {};
32 | 258 | 48µs |  |  | $merge ||= {};
33 | 258 | 184µs |  |  | my @groups = @$groups;
34 |  |  |  |  |
35 | 258 | 462µs |  |  | for my $i (reverse 0 .. $#groups) {
36 | 1081 | 1.10ms | 1081 | 1.29ms | if (my $group_name = _group_name($groups[$i][0])) { # spent 1.29ms making 1081 calls to Sub::Exporter::_group_name, avg 1µs/call
37 | 140 | 173µs |  |  | my $seen = { %$seen }; # faux-dynamic scoping
38 |  |  |  |  |
39 | 140 | 394µs | 140 | 15.0ms | splice @groups, $i, 1, # spent 26.8ms making 140 calls to Sub::Exporter::_expand_group, avg 191µs/call, recursion: max depth 1, sum of overlapping time 11.8ms
40 |  |  |  |  | _expand_group($class, $config, $groups[$i], $collection, $seen, $merge);
41 |  |  |  |  | } else {
42 |  |  |  |  | # there's nothing to munge in this export's args
43 | 941 | 646µs |  |  | next unless my %merge = %$merge;
44 |  |  |  |  |
45 |  |  |  |  | # we have things to merge in; do so
46 |  |  |  |  | my $prefix = (delete $merge{-prefix}) || '';
47 |  |  |  |  | my $suffix = (delete $merge{-suffix}) || '';
48 |  |  |  |  |
49 |  |  |  |  | if (
50 |  |  |  |  | Params::Util::_CODELIKE($groups[$i][1]) ## no critic Private
51 |  |  |  |  | or
52 |  |  |  |  | Params::Util::_SCALAR0($groups[$i][1]) ## no critic Private
53 |  |  |  |  | ) {
54 |  |  |  |  | # this entry was build by a group generator
55 |  |  |  |  | $groups[$i][0] = $prefix . $groups[$i][0] . $suffix;
56 |  |  |  |  | } else {
57 |  |  |  |  | my $as
58 |  |  |  |  | = ref $groups[$i][1]{-as} ? $groups[$i][1]{-as}
59 |  |  |  |  | : $groups[$i][1]{-as} ? $prefix . $groups[$i][1]{-as} . $suffix
60 |  |  |  |  | : $prefix . $groups[$i][0] . $suffix;
61 |  |  |  |  |
62 |  |  |  |  | $groups[$i][1] = { %{ $groups[$i][1] }, %merge, -as => $as };
63 |  |  |  |  | }
64 |  |  |  |  | }
65 |  |  |  |  | }
66 |  |  |  |  |
67 | 258 | 560µs |  |  | return \@groups;
68 |  |  |  |  | }
69 |  |  |  |  |
70 |  |  |  |  | # \@group is a name/value pair from an opt list.
71 |  |  |  |  | # spent 15.0ms (2.08+12.9) within Sub::Exporter::_expand_group which was called 140 times, avg 107µs/call: # 140 times (2.08ms+12.9ms) by Sub::Exporter::_expand_groups at line 39, avg 107µs/call sub _expand_group {
72 | 140 | 59µs |  |  | my ($class, $config, $group, $collection, $seen, $merge) = @_;
73 | 140 | 23µs |  |  | $merge ||= {};
74 |  |  |  |  |
75 | 140 | 47µs |  |  | my ($group_name, $group_arg) = @$group;
76 | 140 | 97µs | 140 | 169µs | $group_name = _group_name($group_name); # spent 169µs making 140 calls to Sub::Exporter::_group_name, avg 1µs/call
77 |  |  |  |  |
78 | 140 | 97µs |  |  | Carp::croak qq(group "$group_name" is not exported by the $class module)
79 |  |  |  |  | unless exists $config->{groups}{$group_name};
80 |  |  |  |  |
81 | 140 | 106µs |  |  | return if $seen->{$group_name}++;
82 |  |  |  |  |
83 | 140 | 25µs |  |  | if (ref $group_arg) {
84 |  |  |  |  | my $prefix = (delete $merge->{-prefix}||'') . ($group_arg->{-prefix}||'');
85 |  |  |  |  | my $suffix = ($group_arg->{-suffix}||'') . (delete $merge->{-suffix}||'');
86 |  |  |  |  | $merge = {
87 |  |  |  |  | %$merge,
88 |  |  |  |  | %$group_arg,
89 |  |  |  |  | ($prefix ? (-prefix => $prefix) : ()),
90 |  |  |  |  | ($suffix ? (-suffix => $suffix) : ()),
91 |  |  |  |  | };
92 |  |  |  |  | }
93 |  |  |  |  |
94 | 140 | 84µs |  |  | my $exports = $config->{groups}{$group_name};
95 |  |  |  |  |
96 | 140 | 720µs | 280 | 221µs | if ( # spent 145µs making 140 calls to Params::Util::_CODELIKE, avg 1µs/call # spent 76µs making 140 calls to Params::Util::_SCALAR0, avg 541ns/call
97 |  |  |  |  | Params::Util::_CODELIKE($exports) ## no critic Private
98 |  |  |  |  | or
99 |  |  |  |  | Params::Util::_SCALAR0($exports) ## no critic Private
100 |  |  |  |  | ) {
101 |  |  |  |  | # I'm not very happy with this code for hiding -prefix and -suffix, but
102 |  |  |  |  | # it's needed, and I'm not sure, offhand, how to make it better.
103 |  |  |  |  | # -- rjbs, 2006-12-05
104 |  |  |  |  | my $group_arg = $merge ? { %$merge } : {};
105 |  |  |  |  | delete $group_arg->{-prefix};
106 |  |  |  |  | delete $group_arg->{-suffix};
107 |  |  |  |  |
108 |  |  |  |  | my $group = Params::Util::_CODELIKE($exports) ## no critic Private
109 |  |  |  |  | ? $exports->($class, $group_name, $group_arg, $collection)
110 |  |  |  |  | : $class->$$exports($group_name, $group_arg, $collection);
111 |  |  |  |  |
112 |  |  |  |  | Carp::croak qq(group generator "$group_name" did not return a hashref)
113 |  |  |  |  | if ref $group ne 'HASH';
114 |  |  |  |  |
115 |  |  |  |  | my $stuff = [ map { [ $_ => $group->{$_} ] } keys %$group ];
116 |  |  |  |  | return @{
117 |  |  |  |  | _expand_groups($class, $config, $stuff, $collection, $seen, $merge)
118 |  |  |  |  | };
119 |  |  |  |  | } else {
120 | 140 | 157µs | 140 | 8.43ms | $exports # spent 8.43ms making 140 calls to Data::OptList::mkopt, avg 60µs/call
121 |  |  |  |  | = Data::OptList::mkopt($exports, "$group_name exports");
122 |  |  |  |  |
123 |  |  |  |  | return @{
124 | 140 | 498µs | 140 | 0s | _expand_groups($class, $config, $exports, $collection, $seen, $merge) # spent 15.9ms making 140 calls to Sub::Exporter::_expand_groups, avg 113µs/call, recursion: max depth 2, sum of overlapping time 15.9ms
125 |  |  |  |  | };
126 |  |  |  |  | }
127 |  |  |  |  | }
128 |  |  |  |  |
129 |  |  |  |  | # spent 700µs within Sub::Exporter::_mk_collection_builder which was called 118 times, avg 6µs/call: # 118 times (700µs+0s) by Sub::Exporter::_collect_collections at line 175, avg 6µs/call sub _mk_collection_builder {
130 | 118 | 43µs |  |  | my ($col, $etc) = @_;
131 | 118 | 101µs |  |  | my ($config, $import_args, $class, $into) = @$etc;
132 |  |  |  |  |
133 | 118 | 23µs |  |  | my %seen;
134 |  |  |  |  | # spent 802µs (147+655) within Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:159] which was called 10 times, avg 80µs/call: # 10 times (147µs+655µs) by Sub::Exporter::_collect_collections at line 177, avg 80µs/call sub {
135 | 10 | 2µs |  |  | my ($collection) = @_;
136 | 10 | 5µs |  |  | my ($name, $value) = @$collection;
137 |  |  |  |  |
138 | 10 | 9µs |  |  | Carp::croak "collection $name provided multiple times in import"
139 |  |  |  |  | if $seen{ $name }++;
140 |  |  |  |  |
141 | 10 | 11µs |  |  | if (ref(my $hook = $config->{collectors}{$name})) {
142 | 10 | 18µs |  |  | my $arg = {
143 |  |  |  |  | name => $name,
144 |  |  |  |  | config => $config,
145 |  |  |  |  | import_args => $import_args,
146 |  |  |  |  | class => $class,
147 |  |  |  |  | into => $into,
148 |  |  |  |  | };
149 |  |  |  |  |
150 | 10 | 9µs |  |  | my $error_msg = "collection $name failed validation";
151 | 10 | 62µs | 14 | 621µs | if (Params::Util::_SCALAR0($hook)) { ## no critic Private # spent 400µs making 1 call to App::Cmd::Setup::_make_app_class # spent 206µs making 3 calls to App::Cmd::_setup_command, avg 69µs/call # spent 15µs making 10 calls to Params::Util::_SCALAR0, avg 1µs/call
152 |  |  |  |  | Carp::croak $error_msg unless $class->$$hook($value, $arg);
153 |  |  |  |  | } else {
154 | 6 | 7µs | 6 | 34µs | Carp::croak $error_msg unless $hook->($value, $arg); # spent 34µs making 6 calls to Sub::Exporter::_setup, avg 6µs/call
155 |  |  |  |  | }
156 |  |  |  |  | }
157 |  |  |  |  |
158 | 10 | 27µs |  |  | $col->{ $name } = $value;
159 |  |  |  |  | }
160 | 118 | 682µs |  |  | }
161 |  |  |  |  |
162 |  |  |  |  | # Given a config and pre-canonicalized importer args, remove collections from
163 |  |  |  |  | # the args and return them.
164 |  |  |  |  | # spent 3.34ms (1.84+1.50) within Sub::Exporter::_collect_collections which was called 118 times, avg 28µs/call: # 118 times (1.84ms+1.50ms) by Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:337] at line 321, avg 28µs/call sub _collect_collections {
165 | 118 | 71µs |  |  | my ($config, $import_args, $class, $into) = @_;
166 |  |  |  |  |
167 |  |  |  |  | my @collections
168 |  |  |  |  | = map { splice @$import_args, $_, 1 }
169 | 118 | 434µs |  |  | grep { exists $config->{collectors}{ $import_args->[$_][0] } }
170 |  |  |  |  | reverse 0 .. $#$import_args;
171 |  |  |  |  |
172 | 118 | 68µs |  |  | unshift @collections, [ INIT => {} ] if $config->{collectors}{INIT};
173 |  |  |  |  |
174 | 118 | 42µs |  |  | my $col = {};
175 | 118 | 196µs | 118 | 700µs | my $builder = _mk_collection_builder($col, \@_); # spent 700µs making 118 calls to Sub::Exporter::_mk_collection_builder, avg 6µs/call
176 | 118 | 111µs |  |  | for my $collection (@collections) {
177 | 10 | 16µs | 10 | 802µs | $builder->($collection) # spent 802µs making 10 calls to Sub::Exporter::__ANON__[Sub/Exporter.pm:159], avg 80µs/call
178 |  |  |  |  | }
179 |  |  |  |  |
180 | 118 | 861µs |  |  | return $col;
181 |  |  |  |  | }
182 |  |  |  |  |
183 |  |  |  |  |
184 |  |  |  |  | # spent 572µs (26+546) within Sub::Exporter::setup_exporter which was called 2 times, avg 286µs/call: # once (12µs+293µs) by Moose::Util::MetaRole::BEGIN@10 at line 36 of Moose/Util.pm # once (14µs+253µs) by App::Cmd::BEGIN@15 at line 461 sub setup_exporter {
185 | 2 | 900ns |  |  | my ($config) = @_;
186 |  |  |  |  |
187 | 2 | 1µs |  |  | Carp::croak 'into and into_level may not both be supplied to exporter'
188 |  |  |  |  | if exists $config->{into} and exists $config->{into_level};
189 |  |  |  |  |
190 | 2 | 2µs |  |  | my $as = delete $config->{as} || 'import';
191 | 2 | 3µs |  |  | my $into
192 |  |  |  |  | = exists $config->{into} ? delete $config->{into}
193 |  |  |  |  | : exists $config->{into_level} ? caller(delete $config->{into_level})
194 |  |  |  |  | : caller(0);
195 |  |  |  |  |
196 | 2 | 3µs | 2 | 446µs | my $import = build_exporter($config); # spent 446µs making 2 calls to Sub::Exporter::build_exporter, avg 223µs/call
197 |  |  |  |  |
198 | 2 | 11µs | 2 | 99µs | Sub::Install::reinstall_sub({ # spent 99µs making 2 calls to Sub::Install::__ANON__[Sub/Install.pm:118], avg 50µs/call
199 |  |  |  |  | code => $import,
200 |  |  |  |  | into => $into,
201 |  |  |  |  | as => $as,
202 |  |  |  |  | });
203 |  |  |  |  | }
204 |  |  |  |  |
205 |  |  |  |  |
206 |  |  |  |  | # spent 79µs within Sub::Exporter::_key_intersection which was called 11 times, avg 7µs/call: # 11 times (79µs+0s) by Sub::Exporter::_rewrite_build_config at line 262, avg 7µs/call sub _key_intersection {
207 | 11 | 4µs |  |  | my ($x, $y) = @_;
208 | 11 | 49µs |  |  | my %seen = map { $_ => 1 } keys %$x;
209 | 11 | 37µs |  |  | my @names = grep { $seen{$_} } keys %$y;
210 |  |  |  |  | }
211 |  |  |  |  |
212 |  |  |  |  | # Given the config passed to setup_exporter, which contains sugary opt list
213 |  |  |  |  | # data, rewrite the opt lists into hashes, catch a few kinds of invalid
214 |  |  |  |  | # configurations, and set up defaults. Since the config is a reference, it's
215 |  |  |  |  | # rewritten in place.
216 | 1 | 100ns |  |  | my %valid_config_key;
217 |  |  |  |  | # spent 9µs within Sub::Exporter::BEGIN@217 which was called: # once (9µs+0s) by App::Cmd::BEGIN@15 at line 222 BEGIN {
218 |  |  |  |  | %valid_config_key =
219 | 1 | 9µs |  |  | map { $_ => 1 }
220 |  |  |  |  | qw(as collectors installer generator exports groups into into_level),
221 |  |  |  |  | qw(exporter), # deprecated
222 | 1 | 923µs | 1 | 9µs | } # spent 9µs making 1 call to Sub::Exporter::BEGIN@217
223 |  |  |  |  |
224 |  |  |  |  | # spent 57µs (48+9) within Sub::Exporter::_assert_collector_names_ok which was called 11 times, avg 5µs/call: # 11 times (48µs+9µs) by Sub::Exporter::_rewrite_build_config at line 260, avg 5µs/call sub _assert_collector_names_ok {
225 | 11 | 4µs |  |  | my ($collectors) = @_;
226 |  |  |  |  |
227 | 18 | 64µs | 7 | 9µs | for my $reserved_name (grep { /\A[_A-Z]+\z/ } keys %$collectors) { # spent 9µs making 7 calls to Sub::Exporter::CORE:match, avg 1µs/call
228 |  |  |  |  | Carp::croak "unknown reserved collector name: $reserved_name"
229 |  |  |  |  | if $reserved_name ne 'INIT';
230 |  |  |  |  | }
231 |  |  |  |  | }
232 |  |  |  |  |
233 |  |  |  |  | # spent 2.30ms (320µs+1.98) within Sub::Exporter::_rewrite_build_config which was called 11 times, avg 209µs/call: # 11 times (320µs+1.98ms) by Sub::Exporter::build_exporter at line 290, avg 209µs/call sub _rewrite_build_config {
234 | 11 | 3µs |  |  | my ($config) = @_;
235 |  |  |  |  |
236 | 11 | 31µs |  |  | if (my @keys = grep { not exists $valid_config_key{$_} } keys %$config) {
237 |  |  |  |  | Carp::croak "unknown options (@keys) passed to Sub::Exporter";
238 |  |  |  |  | }
239 |  |  |  |  |
240 | 11 | 7µs |  |  | Carp::croak q(into and into_level may not both be supplied to exporter)
241 |  |  |  |  | if exists $config->{into} and exists $config->{into_level};
242 |  |  |  |  |
243 |  |  |  |  | # XXX: Remove after deprecation period.
244 | 11 | 5µs |  |  | if ($config->{exporter}) {
245 |  |  |  |  | Carp::cluck "'exporter' argument to build_exporter is deprecated. Use 'installer' instead; the semantics are identical.";
246 |  |  |  |  | $config->{installer} = delete $config->{exporter};
247 |  |  |  |  | }
248 |  |  |  |  |
249 | 11 | 6µs |  |  | Carp::croak q(into and into_level may not both be supplied to exporter)
250 |  |  |  |  | if exists $config->{into} and exists $config->{into_level};
251 |  |  |  |  |
252 | 11 | 8µs |  |  | for (qw(exports collectors)) {
253 | 22 | 72µs | 22 | 1.55ms | $config->{$_} = Data::OptList::mkopt_hash( # spent 1.55ms making 22 calls to Data::OptList::mkopt_hash, avg 71µs/call
254 |  |  |  |  | $config->{$_},
255 |  |  |  |  | $_,
256 |  |  |  |  | [ 'CODE', 'SCALAR' ],
257 |  |  |  |  | );
258 |  |  |  |  | }
259 |  |  |  |  |
260 | 11 | 18µs | 11 | 57µs | _assert_collector_names_ok($config->{collectors}); # spent 57µs making 11 calls to Sub::Exporter::_assert_collector_names_ok, avg 5µs/call
261 |  |  |  |  |
262 | 11 | 24µs | 11 | 79µs | if (my @names = _key_intersection(@$config{qw(exports collectors)})) { # spent 79µs making 11 calls to Sub::Exporter::_key_intersection, avg 7µs/call
263 |  |  |  |  | Carp::croak "names (@names) used in both collections and exports";
264 |  |  |  |  | }
265 |  |  |  |  |
266 | 11 | 35µs | 11 | 292µs | $config->{groups} = Data::OptList::mkopt_hash( # spent 292µs making 11 calls to Data::OptList::mkopt_hash, avg 27µs/call
267 |  |  |  |  | $config->{groups},
268 |  |  |  |  | 'groups',
269 |  |  |  |  | [
270 |  |  |  |  | 'HASH', # standard opt list
271 |  |  |  |  | 'ARRAY', # standard opt list
272 |  |  |  |  | 'CODE', # group generator
273 |  |  |  |  | 'SCALAR', # name of group generation method
274 |  |  |  |  | ]
275 |  |  |  |  | );
276 |  |  |  |  |
277 |  |  |  |  | # by default, export nothing
278 | 11 | 10µs |  |  | $config->{groups}{default} ||= [];
279 |  |  |  |  |
280 |  |  |  |  | # by default, build an all-inclusive 'all' group
281 | 11 | 20µs |  |  | $config->{groups}{all} ||= [ keys %{ $config->{exports} } ];
282 |  |  |  |  |
283 | 11 | 12µs |  |  | $config->{generator} ||= \&default_generator;
284 | 11 | 26µs |  |  | $config->{installer} ||= \&default_installer;
285 |  |  |  |  | }
286 |  |  |  |  |
287 |  |  |  |  | # spent 2.38ms (85µs+2.30) within Sub::Exporter::build_exporter which was called 11 times, avg 217µs/call: # 6 times (45µs+726µs) by Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:460] at line 460, avg 128µs/call # 3 times (27µs+1.14ms) by Moose::Exporter::_make_exporter at line 142 of Moose/Exporter.pm, avg 389µs/call # 2 times (13µs+433µs) by Sub::Exporter::setup_exporter at line 196, avg 223µs/call sub build_exporter {
288 | 11 | 4µs |  |  | my ($config) = @_;
289 |  |  |  |  |
290 | 11 | 12µs | 11 | 2.30ms | _rewrite_build_config($config); # spent 2.30ms making 11 calls to Sub::Exporter::_rewrite_build_config, avg 209µs/call
291 |  |  |  |  |
292 |  |  |  |  | # spent 100ms (2.68+97.5) within Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:337] which was called 118 times, avg 849µs/call: # 67 times (1.61ms+90.4ms) by Moose::Role::import or Moose::Util::TypeConstraints::import or Moose::import at line 527 of Moose/Exporter.pm, avg 1.37ms/call # once (15µs+455µs) by PONAPI::CLI::BEGIN@5 at line 93 of App/Cmd/Setup.pm # once (31µs+344µs) by HTTP::Headers::ActionPack::Util::BEGIN@17 at line 17 of HTTP/Headers/ActionPack/Util.pm # once (19µs+343µs) by Getopt::Long::Descriptive::BEGIN@268 at line 272 of Getopt/Long/Descriptive.pm # once (26µs+308µs) by Sub::Exporter::Util::BEGIN@198 at line 198 of Sub/Exporter/Util.pm # once (29µs+255µs) by HTTP::Headers::ActionPack::PriorityList::BEGIN@13 at line 13 of HTTP/Headers/ActionPack/PriorityList.pm # once (17µs+250µs) by App::Cmd::BEGIN@15 at line 24 of App/Cmd.pm # once (15µs+251µs) by App::Cmd::Setup::BEGIN@82 at line 82 of App/Cmd/Setup.pm # once (19µs+223µs) by String::RewritePrefix::BEGIN@11 at line 11 of String/RewritePrefix.pm # once (22µs+186µs) by HTTP::Headers::ActionPack::Core::BaseHeaderType::BEGIN@15 at line 15 of HTTP/Headers/ActionPack/Core/BaseHeaderType.pm # once (24µs+162µs) by Moose::Util::TypeConstraints::BEGIN@36 at line 36 of Moose/Util/TypeConstraints.pm # once (26µs+155µs) by PONAPI::CLI::Command::manual::BEGIN@4 at line 4 of lib/PONAPI/CLI/Command/manual.pm # once (27µs+153µs) by Moose::Meta::TypeConstraint::Enum::BEGIN@13 at line 13 of Moose/Meta/TypeConstraint/Enum.pm # once (27µs+145µs) by Moose::Meta::Method::Accessor::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor.pm # once (27µs+140µs) by Moose::Meta::TypeCoercion::BEGIN@11 at line 11 of Moose/Meta/TypeCoercion.pm # once (26µs+136µs) by Moose::Meta::Role::Attribute::BEGIN@12 at line 12 of Moose/Meta/Role/Attribute.pm # once (26µs+135µs) by Moose::Meta::Role::Composite::BEGIN@9 at line 9 of Moose/Meta/Role/Composite.pm # once (24µs+136µs) by Moose::Meta::Method::Overridden::BEGIN@9 at line 9 of Moose/Meta/Method/Overridden.pm # once (25µs+134µs) by Moose::Meta::TypeConstraint::BEGIN@20 at line 20 of Moose/Meta/TypeConstraint.pm # once (18µs+141µs) by PONAPI::CLI::Command::demo::BEGIN@4 at line 4 of lib/PONAPI/CLI/Command/demo.pm # once (24µs+133µs) by HTTP::Headers::ActionPack::Core::BaseHeaderList::BEGIN@14 at line 14 of HTTP/Headers/ActionPack/Core/BaseHeaderList.pm # once (25µs+130µs) by Moose::Meta::Role::Application::BEGIN@11 at line 11 of Moose/Meta/Role/Application.pm # once (38µs+116µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Parameterized.pm # once (25µs+129µs) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (24µs+129µs) by Moose::Meta::Role::BEGIN@16 at line 16 of Moose/Meta/Role.pm # once (21µs+130µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint/Registry.pm # once (23µs+128µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/DuckType.pm # once (21µs+122µs) by Moose::Meta::Role::Application::ToClass::BEGIN@9 at line 9 of Moose/Meta/Role/Application/ToClass.pm # once (18µs+116µs) by PONAPI::CLI::Command::gen::BEGIN@4 at line 4 of lib/PONAPI/CLI/Command/gen.pm # once (18µs+110µs) by Moose::Role::BEGIN@14 at line 14 of Moose/Role.pm # once (19µs+106µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@15 at line 15 of Moose/Meta/Role/Application/RoleSummation.pm # once (25µs+100µs) by Moose::Util::BEGIN@10 at line 10 of Moose/Util.pm # once (18µs+104µs) by Moose::Meta::Role::Application::ToRole::BEGIN@10 at line 10 of Moose/Meta/Role/Application/ToRole.pm # once (15µs+103µs) by Moose::Meta::Method::Delegation::BEGIN@12 at line 12 of Moose/Meta/Method/Delegation.pm # once (27µs+89µs) by Moose::Role::BEGIN@11 at line 11 of Moose/Role.pm # once (15µs+100µs) by Moose::Util::MetaRole::BEGIN@10 at line 10 of Moose/Util/MetaRole.pm # once (22µs+90µs) by Moose::BEGIN@41 at line 41 of Moose.pm # once (22µs+85µs) by Moose::Meta::Role::Method::Conflicting::BEGIN@7 at line 7 of Moose/Meta/Role/Method/Conflicting.pm # once (17µs+89µs) by Moose::Meta::TypeCoercion::Union::BEGIN@12 at line 12 of Moose/Meta/TypeCoercion/Union.pm # once (16µs+86µs) by Moose::Meta::Attribute::BEGIN@15 at line 15 of Moose/Meta/Attribute.pm # once (15µs+86µs) by Moose::Meta::Class::Immutable::Trait::BEGIN@12 at line 12 of Moose/Meta/Class/Immutable/Trait.pm # once (18µs+81µs) by Moose::Meta::Method::Accessor::Native::BEGIN@12 at line 12 of Moose/Meta/Method/Accessor/Native.pm # once (15µs+82µs) by Moose::Meta::Method::Constructor::BEGIN@12 at line 12 of Moose/Meta/Method/Constructor.pm # once (15µs+82µs) by Moose::Meta::Method::Augmented::BEGIN@9 at line 9 of Moose/Meta/Method/Augmented.pm # once (15µs+80µs) by Moose::Meta::Class::BEGIN@19 at line 19 of Moose/Meta/Class.pm # once (18µs+78µs) by PONAPI::Exception::BEGIN@5 at line 5 of lib/PONAPI/Exception.pm # once (17µs+78µs) by Moose::Meta::Attribute::Native::Trait::BEGIN@7 at line 7 of Moose/Meta/Attribute/Native/Trait.pm # once (14µs+79µs) by Moose::Meta::Method::Destructor::BEGIN@14 at line 14 of Moose/Meta/Method/Destructor.pm # once (14µs+78µs) by Moose::Exporter::BEGIN@15 at line 15 of Moose/Exporter.pm # once (16µs+73µs) by main::BEGIN@9 at line 9 of script/ponapi # once (18µs+68µs) by Moose::Meta::Method::Accessor::Native::Writer::BEGIN@8 at line 8 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (16µs+64µs) by Moose::Exporter::BEGIN@12 at line 12 of Moose/Exporter.pm my $import = sub {
293 | 118 | 79µs |  |  | my ($class) = shift;
294 |  |  |  |  |
295 |  |  |  |  | # XXX: clean this up -- rjbs, 2006-03-16
296 | 118 | 81µs |  |  | my $special = (ref $_[0]) ? shift(@_) : {};
297 | 118 | 62µs |  |  | Carp::croak q(into and into_level may not both be supplied to exporter)
298 |  |  |  |  | if exists $special->{into} and exists $special->{into_level};
299 |  |  |  |  |
300 | 118 | 41µs |  |  | if ($special->{exporter}) {
301 |  |  |  |  | Carp::cluck "'exporter' special import argument is deprecated. Use 'installer' instead; the semantics are identical.";
302 |  |  |  |  | $special->{installer} = delete $special->{exporter};
303 |  |  |  |  | }
304 |  |  |  |  |
305 | 118 | 253µs |  |  | my $into
306 |  |  |  |  | = defined $special->{into} ? delete $special->{into}
307 |  |  |  |  | : defined $special->{into_level} ? caller(delete $special->{into_level})
308 |  |  |  |  | : defined $config->{into} ? $config->{into}
309 |  |  |  |  | : defined $config->{into_level} ? caller($config->{into_level})
310 |  |  |  |  | : caller(0);
311 |  |  |  |  |
312 | 118 | 107µs |  |  | my $generator = delete $special->{generator} || $config->{generator};
313 | 118 | 73µs |  |  | my $installer = delete $special->{installer} || $config->{installer};
314 |  |  |  |  |
315 |  |  |  |  | # this builds a AOA, where the inner arrays are [ name => value_ref ]
316 | 118 | 203µs | 118 | 1.09ms | my $import_args = Data::OptList::mkopt([ @_ ]); # spent 1.09ms making 118 calls to Data::OptList::mkopt, avg 9µs/call
317 |  |  |  |  |
318 |  |  |  |  | # is this right? defaults first or collectors first? -- rjbs, 2006-06-24
319 | 118 | 137µs |  |  | $import_args = [ [ -default => undef ] ] unless @$import_args;
320 |  |  |  |  |
321 | 118 | 215µs | 118 | 3.34ms | my $collection = _collect_collections($config, $import_args, $class, $into); # spent 3.34ms making 118 calls to Sub::Exporter::_collect_collections, avg 28µs/call
322 |  |  |  |  |
323 | 118 | 186µs | 118 | 16.7ms | my $to_import = _expand_groups($class, $config, $import_args, $collection); # spent 16.7ms making 118 calls to Sub::Exporter::_expand_groups, avg 142µs/call
324 |  |  |  |  |
325 |  |  |  |  | # now, finally $import_arg is really the "to do" list
326 | 118 | 942µs | 118 | 76.4ms | _do_import( # spent 76.4ms making 118 calls to Sub::Exporter::_do_import, avg 647µs/call
327 |  |  |  |  | {
328 |  |  |  |  | class => $class,
329 |  |  |  |  | col => $collection,
330 |  |  |  |  | config => $config,
331 |  |  |  |  | into => $into,
332 |  |  |  |  | generator => $generator,
333 |  |  |  |  | installer => $installer,
334 |  |  |  |  | },
335 |  |  |  |  | $to_import,
336 |  |  |  |  | );
337 | 11 | 45µs |  |  | };
338 |  |  |  |  |
339 | 11 | 28µs |  |  | return $import;
340 |  |  |  |  | }
341 |  |  |  |  |
342 |  |  |  |  | # spent 76.4ms (6.17+70.2) within Sub::Exporter::_do_import which was called 118 times, avg 647µs/call: # 118 times (6.17ms+70.2ms) by Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:337] at line 326, avg 647µs/call sub _do_import {
343 | 118 | 47µs |  |  | my ($arg, $to_import) = @_;
344 |  |  |  |  |
345 | 118 | 27µs |  |  | my @todo;
346 |  |  |  |  |
347 | 118 | 101µs |  |  | for my $pair (@$to_import) {
348 | 941 | 250µs |  |  | my ($name, $import_arg) = @$pair;
349 |  |  |  |  |
350 | 941 | 75µs |  |  | my ($generator, $as);
351 |  |  |  |  |
352 | 941 | 223µs | 6 | 5µs | if ($import_arg and Params::Util::_CODELIKE($import_arg)) { ## no critic # spent 5µs making 6 calls to Params::Util::_CODELIKE, avg 817ns/call
353 |  |  |  |  | # This is the case when a group generator has inserted name/code pairs.
354 |  |  |  |  | $generator = sub { $import_arg };
355 |  |  |  |  | $as = $name;
356 |  |  |  |  | } else {
357 | 941 | 272µs |  |  | $import_arg = { $import_arg ? %$import_arg : () };
358 |  |  |  |  |
359 | 941 | 426µs |  |  | Carp::croak qq("$name" is not exported by the $arg->{class} module)
360 |  |  |  |  | unless exists $arg->{config}{exports}{$name};
361 |  |  |  |  |
362 | 941 | 344µs |  |  | $generator = $arg->{config}{exports}{$name};
363 |  |  |  |  |
364 | 941 | 442µs |  |  | $as = exists $import_arg->{-as} ? (delete $import_arg->{-as}) : $name;
365 |  |  |  |  | }
366 |  |  |  |  |
367 | 941 | 2.02ms | 941 | 17.0ms | my $code = $arg->{generator}->( # spent 17.0ms making 941 calls to Sub::Exporter::default_generator, avg 18µs/call
368 |  |  |  |  | {
369 |  |  |  |  | class => $arg->{class},
370 |  |  |  |  | name => $name,
371 |  |  |  |  | arg => $import_arg,
372 |  |  |  |  | col => $arg->{col},
373 |  |  |  |  | generator => $generator,
374 |  |  |  |  | }
375 |  |  |  |  | );
376 |  |  |  |  |
377 | 941 | 857µs |  |  | push @todo, $as, $code;
378 |  |  |  |  | }
379 |  |  |  |  |
380 | 118 | 512µs | 118 | 52.3ms | $arg->{installer}->( # spent 50.3ms making 67 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:140], avg 751µs/call # spent 2.01ms making 51 calls to Sub::Exporter::default_installer, avg 39µs/call
381 |  |  |  |  | {
382 |  |  |  |  | class => $arg->{class},
383 |  |  |  |  | into => $arg->{into},
384 |  |  |  |  | col => $arg->{col},
385 |  |  |  |  | },
386 |  |  |  |  | \@todo,
387 |  |  |  |  | );
388 |  |  |  |  | }
389 |  |  |  |  |
390 |  |  |  |  | ## Cute idea, possibly for future use: also supply an "unimport" for:
391 |  |  |  |  | ## no Module::Whatever qw(arg arg arg);
392 |  |  |  |  | # sub _unexport {
393 |  |  |  |  | # my (undef, undef, undef, undef, undef, $as, $into) = @_;
394 |  |  |  |  | #
395 |  |  |  |  | # if (ref $as eq 'SCALAR') {
396 |  |  |  |  | # undef $$as;
397 |  |  |  |  | # } elsif (ref $as) {
398 |  |  |  |  | # Carp::croak "invalid reference type for $as: " . ref $as;
399 |  |  |  |  | # } else {
400 |  |  |  |  | # no strict 'refs';
401 |  |  |  |  | # delete &{$into . '::' . $as};
402 |  |  |  |  | # }
403 |  |  |  |  | # }
404 |  |  |  |  |
405 |  |  |  |  |
406 |  |  |  |  | # spent 17.0ms (8.23+8.79) within Sub::Exporter::default_generator which was called 941 times, avg 18µs/call: # 941 times (8.23ms+8.79ms) by Sub::Exporter::_do_import at line 367, avg 18µs/call sub default_generator {
407 | 941 | 179µs |  |  | my ($arg) = @_;
408 | 941 | 550µs |  |  | my ($class, $name, $generator) = @$arg{qw(class name generator)};
409 |  |  |  |  |
410 | 941 | 118µs |  |  | if (not defined $generator) {
411 | 37 | 188µs | 37 | 68µs | my $code = $class->can($name) # spent 68µs making 37 calls to UNIVERSAL::can, avg 2µs/call
412 |  |  |  |  | or Carp::croak "can't locate exported subroutine $name via $class";
413 | 37 | 90µs |  |  | return $code;
414 |  |  |  |  | }
415 |  |  |  |  |
416 |  |  |  |  | # I considered making this "$class->$generator(" but it seems that
417 |  |  |  |  | # overloading precedence would turn an overloaded-as-code generator object
418 |  |  |  |  | # into a string before code. -- rjbs, 2006-06-11
419 | 904 | 3.76ms | 1808 | 8.73ms | return $generator->($class, $name, $arg->{arg}, $arg->{col}) # spent 7.13ms making 504 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:389], avg 14µs/call # spent 791µs making 6 calls to Sub::Exporter::__ANON__[Sub/Exporter.pm:460], avg 132µs/call # spent 423µs making 394 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:317], avg 1µs/call # spent 378µs making 904 calls to Params::Util::_CODELIKE, avg 418ns/call
420 |  |  |  |  | if Params::Util::_CODELIKE($generator); ## no critic Private
421 |  |  |  |  |
422 |  |  |  |  | # This "must" be a scalar reference, to a generator method name.
423 |  |  |  |  | # -- rjbs, 2006-12-05
424 |  |  |  |  | return $class->$$generator($name, $arg->{arg}, $arg->{col});
425 |  |  |  |  | }
426 |  |  |  |  |
427 |  |  |  |  |
428 |  |  |  |  | # spent 30.8ms (3.99+26.8) within Sub::Exporter::default_installer which was called 118 times, avg 261µs/call: # 65 times (3.50ms+24.4ms) by Moose::Exporter::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Exporter.pm:140] at line 132 of Moose/Exporter.pm, avg 429µs/call # 51 times (362µs+1.65ms) by Sub::Exporter::_do_import at line 380, avg 39µs/call # 2 times (134µs+753µs) by Sub::Exporter::_do_import at line 113 of Moose/Exporter.pm, avg 443µs/call sub default_installer {
429 | 118 | 39µs |  |  | my ($arg, $to_export) = @_;
430 |  |  |  |  |
431 | 118 | 1.05ms |  |  | for (my $i = 0; $i < @$to_export; $i += 2) {
432 | 939 | 419µs |  |  | my ($as, $code) = @$to_export[ $i, $i+1 ];
433 |  |  |  |  |
434 |  |  |  |  | # Allow as isa ARRAY to push onto an array?
435 |  |  |  |  | # Allow into isa HASH to install name=>code into hash?
436 |  |  |  |  |
437 | 939 | 388µs |  |  | if (ref $as eq 'SCALAR') {
438 |  |  |  |  | $$as = $code;
439 |  |  |  |  | } elsif (ref $as) {
440 |  |  |  |  | Carp::croak "invalid reference type for $as: " . ref $as;
441 |  |  |  |  | } else {
442 | 939 | 1.61ms | 939 | 26.8ms | Sub::Install::reinstall_sub({ # spent 26.8ms making 939 calls to Sub::Install::__ANON__[Sub/Install.pm:118], avg 29µs/call
443 |  |  |  |  | code => $code,
444 |  |  |  |  | into => $arg->{into},
445 |  |  |  |  | as => $as
446 |  |  |  |  | });
447 |  |  |  |  | }
448 |  |  |  |  | }
449 |  |  |  |  | }
450 |  |  |  |  |
451 |  |  |  |  | sub default_exporter {
452 |  |  |  |  | Carp::cluck "default_exporter is deprecated; call default_installer instead; the semantics are identical";
453 |  |  |  |  | goto &default_installer;
454 |  |  |  |  | }
455 |  |  |  |  |
456 |  |  |  |  |
457 |  |  |  |  | setup_exporter({
458 |  |  |  |  | exports => [
459 |  |  |  |  | qw(setup_exporter build_exporter),
460 | 6 | 18µs | 6 | 770µs | # spent 791µs (20+770) within Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:460] which was called 6 times, avg 132µs/call: # 6 times (20µs+770µs) by Sub::Exporter::default_generator at line 419, avg 132µs/call _import => sub { build_exporter($_[2]) }, # spent 770µs making 6 calls to Sub::Exporter::build_exporter, avg 128µs/call
461 | 1 | 8µs | 1 | 268µs | ], # spent 268µs making 1 call to Sub::Exporter::setup_exporter
462 |  |  |  |  | groups => {
463 |  |  |  |  | all => [ qw(setup_exporter build_export) ],
464 |  |  |  |  | },
465 |  |  |  |  | collectors => { -setup => \&_setup },
466 |  |  |  |  | });
467 |  |  |  |  |
468 |  |  |  |  | # spent 34µs within Sub::Exporter::_setup which was called 6 times, avg 6µs/call: # 6 times (34µs+0s) by Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:159] at line 154, avg 6µs/call sub _setup {
469 | 6 | 2µs |  |  | my ($value, $arg) = @_;
470 |  |  |  |  |
471 | 6 | 4µs |  |  | if (ref $value eq 'HASH') {
472 | 6 | 20µs |  |  | push @{ $arg->{import_args} }, [ _import => { -as => 'import', %$value } ];
473 | 6 | 17µs |  |  | return 1;
474 |  |  |  |  | } elsif (ref $value eq 'ARRAY') {
475 |  |  |  |  | push @{ $arg->{import_args} },
476 |  |  |  |  | [ _import => { -as => 'import', exports => $value } ];
477 |  |  |  |  | return 1;
478 |  |  |  |  | }
479 |  |  |  |  | return;
480 |  |  |  |  | }
481 |  |  |  |  |
- - |  |  |  |  |
484 | 1 | 5µs |  |  | "jn8:32"; # <-- magic true value
485 |  |  |  |  |
486 |  |  |  |  | __END__
|  |  |  |  | # spent 9µs within Sub::Exporter::CORE:match which was called 7 times, avg 1µs/call: # 7 times (9µs+0s) by Sub::Exporter::_assert_collector_names_ok at line 227, avg 1µs/call sub Sub::Exporter::CORE:match; # opcode