Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Exporter/Tiny.pm |
Statements | Executed 1784 statements in 8.97ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
29 | 29 | 29 | 4.02ms | 10.00ms | import | Exporter::Tiny::
34 | 1 | 1 | 2.34ms | 3.12ms | _exporter_install_sub | Exporter::Tiny::
29 | 1 | 1 | 909µs | 909µs | CORE:sort (opcode) | Exporter::Tiny::
29 | 1 | 1 | 848µs | 1.94ms | _exporter_permitted_regexp | Exporter::Tiny::
34 | 1 | 1 | 386µs | 607µs | _exporter_expand_sub | Exporter::Tiny::
29 | 1 | 1 | 208µs | 208µs | mkopt | Exporter::Tiny::
63 | 2 | 1 | 188µs | 188µs | CORE:regcomp (opcode) | Exporter::Tiny::
170 | 2 | 1 | 119µs | 119µs | CORE:match (opcode) | Exporter::Tiny::
29 | 1 | 1 | 42µs | 42µs | CORE:qr (opcode) | Exporter::Tiny::
29 | 1 | 1 | 36µs | 36µs | _exporter_validate_opts | Exporter::Tiny::
1 | 1 | 1 | 14µs | 14µs | BEGIN@3 | Exporter::Tiny::
1 | 1 | 1 | 10µs | 20µs | BEGIN@17 | Exporter::Tiny::
1 | 1 | 1 | 7µs | 17µs | BEGIN@214 | Exporter::Tiny::
1 | 1 | 1 | 7µs | 17µs | BEGIN@100 | Exporter::Tiny::
1 | 1 | 1 | 7µs | 17µs | BEGIN@127 | Exporter::Tiny::
1 | 1 | 1 | 7µs | 24µs | BEGIN@5.2 | Exporter::Tiny::
1 | 1 | 1 | 7µs | 16µs | BEGIN@141 | Exporter::Tiny::
1 | 1 | 1 | 7µs | 19µs | BEGIN@158 | Exporter::Tiny::
1 | 1 | 1 | 6µs | 10µs | BEGIN@5 | Exporter::Tiny::
1 | 1 | 1 | 6µs | 17µs | BEGIN@4 | Exporter::Tiny::
0 | 0 | 0 | 0s | 0s | _croak | Exporter::Tiny::
0 | 0 | 0 | 0s | 0s | _exporter_expand_regexp | Exporter::Tiny::
0 | 0 | 0 | 0s | 0s | _exporter_expand_tag | Exporter::Tiny::
0 | 0 | 0 | 0s | 0s | _exporter_fail | Exporter::Tiny::
0 | 0 | 0 | 0s | 0s | _exporter_merge_opts | Exporter::Tiny::
0 | 0 | 0 | 0s | 0s | mkopt_hash | Exporter::Tiny::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Exporter::Tiny; | ||||
2 | |||||
3 | 2 | 35µs | 1 | 14µs | # spent 14µs within Exporter::Tiny::BEGIN@3 which was called:
# once (14µs+0s) by List::MoreUtils::BEGIN@12 at line 3 # spent 14µs making 1 call to Exporter::Tiny::BEGIN@3 |
4 | 2 | 17µs | 2 | 28µs | # spent 17µs (6+11) within Exporter::Tiny::BEGIN@4 which was called:
# once (6µs+11µs) by List::MoreUtils::BEGIN@12 at line 4 # spent 17µs making 1 call to Exporter::Tiny::BEGIN@4
# spent 11µs making 1 call to strict::import |
5 | 4 | 126µs | 4 | 56µs | use warnings; no warnings qw(void once uninitialized numeric redefine); # spent 24µs making 1 call to Exporter::Tiny::BEGIN@5.2
# spent 18µs making 1 call to warnings::unimport
# spent 10µs making 1 call to Exporter::Tiny::BEGIN@5
# spent 4µs making 1 call to warnings::import |
6 | |||||
7 | 1 | 600ns | our $AUTHORITY = 'cpan:TOBYINK'; | ||
8 | 1 | 200ns | our $VERSION = '0.038'; | ||
9 | 1 | 1µs | our @EXPORT_OK = qw< mkopt mkopt_hash _croak >; | ||
10 | |||||
11 | sub _croak ($;@) { require Carp; my $fmt = shift; @_ = sprintf($fmt, @_); goto \&Carp::croak } | ||||
12 | |||||
13 | sub import | ||||
14 | # spent 10.00ms (4.02+5.97) within Exporter::Tiny::import which was called 29 times, avg 345µs/call:
# once (2.95ms+140µs) by Perl::Critic::Policy::Subroutines::ProhibitManyArgs::BEGIN@17 at line 17 of Perl/Critic/Policy/Subroutines/ProhibitManyArgs.pm
# once (61µs+2.63ms) by Perl::Critic::BEGIN@20 at line 20 of Perl/Critic.pm
# once (59µs+166µs) by Perl::Critic::Config::BEGIN@17 at line 17 of Perl/Critic/Config.pm
# once (59µs+155µs) by Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::BEGIN@15 at line 15 of Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm
# once (49µs+163µs) by Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin::BEGIN@14 at line 14 of Perl/Critic/Policy/InputOutput/ProhibitExplicitStdin.pm
# once (41µs+144µs) by Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::BEGIN@15 at line 15 of Perl/Critic/Policy/TestingAndDebugging/ProhibitNoStrict.pm
# once (44µs+135µs) by Perl::Critic::Policy::Subroutines::RequireArgUnpacking::BEGIN@20 at line 20 of Perl/Critic/Policy/Subroutines/RequireArgUnpacking.pm
# once (41µs+136µs) by Perl::Critic::Policy::InputOutput::ProhibitJoinedReadline::BEGIN@14 at line 14 of Perl/Critic/Policy/InputOutput/ProhibitJoinedReadline.pm
# once (40µs+125µs) by PPIx::Regexp::Element::BEGIN@39 at line 39 of PPIx/Regexp/Element.pm
# once (43µs+122µs) by Perl::Critic::Theme::BEGIN@18 at line 18 of Perl/Critic/Theme.pm
# once (41µs+123µs) by Perl::Critic::Policy::Modules::ProhibitAutomaticExportation::BEGIN@16 at line 16 of Perl/Critic/Policy/Modules/ProhibitAutomaticExportation.pm
# once (41µs+121µs) by Perl::Critic::Policy::Documentation::PodSpelling::BEGIN@20 at line 20 of Perl/Critic/Policy/Documentation/PodSpelling.pm
# once (40µs+120µs) by Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration::BEGIN@13 at line 13 of Perl/Critic/Policy/Variables/ProhibitAugmentedAssignmentInDeclaration.pm
# once (39µs+118µs) by Perl::Critic::Policy::Variables::ProhibitPackageVars::BEGIN@17 at line 17 of Perl/Critic/Policy/Variables/ProhibitPackageVars.pm
# once (35µs+117µs) by Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals::BEGIN@15 at line 15 of Perl/Critic/Policy/ValuesAndExpressions/ProhibitInterpolationOfLiterals.pm
# once (34µs+113µs) by Perl::Critic::Policy::Modules::RequireVersionVar::BEGIN@15 at line 15 of Perl/Critic/Policy/Modules/RequireVersionVar.pm
# once (32µs+109µs) by Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings::BEGIN@15 at line 15 of Perl/Critic/Policy/TestingAndDebugging/ProhibitNoWarnings.pm
# once (33µs+106µs) by Perl::Critic::Policy::Variables::ProhibitReusedNames::BEGIN@13 at line 13 of Perl/Critic/Policy/Variables/ProhibitReusedNames.pm
# once (31µs+107µs) by Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins::BEGIN@15 at line 15 of Perl/Critic/Policy/CodeLayout/ProhibitParensWithBuiltins.pm
# once (33µs+105µs) by Perl::Critic::Policy::RegularExpressions::ProhibitEnumeratedClasses::BEGIN@16 at line 16 of Perl/Critic/Policy/RegularExpressions/ProhibitEnumeratedClasses.pm
# once (31µs+106µs) by Perl::Critic::Policy::InputOutput::RequireBriefOpen::BEGIN@16 at line 16 of Perl/Critic/Policy/InputOutput/RequireBriefOpen.pm
# once (31µs+106µs) by Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation::BEGIN@16 at line 16 of Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm
# once (30µs+102µs) by Perl::Critic::Policy::Miscellanea::ProhibitUselessNoCritic::BEGIN@16 at line 16 of Perl/Critic/Policy/Miscellanea/ProhibitUselessNoCritic.pm
# once (30µs+101µs) by Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels::BEGIN@15 at line 15 of Perl/Critic/Policy/TestingAndDebugging/RequireTestLabels.pm
# once (30µs+101µs) by Perl::Critic::Policy::Variables::ProhibitUnusedVariables::BEGIN@15 at line 15 of Perl/Critic/Policy/Variables/ProhibitUnusedVariables.pm
# once (31µs+100µs) by Perl::Critic::PolicyFactory::BEGIN@17 at line 17 of Perl/Critic/PolicyFactory.pm
# once (30µs+100µs) by Perl::Critic::Policy::NamingConventions::Capitalization::BEGIN@17 at line 17 of Perl/Critic/Policy/NamingConventions/Capitalization.pm
# once (30µs+99µs) by Perl::Critic::Policy::RegularExpressions::ProhibitUnusedCapture::BEGIN@16 at line 16 of Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm
# once (30µs+98µs) by Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/ProhibitEscapedMetacharacters.pm | ||||
15 | 29 | 14µs | my $class = shift; | ||
16 | 29 | 41µs | my $global_opts = +{ @_ && ref($_[0]) eq q(HASH) ? %{+shift} : () }; | ||
17 | 60 | 450µs | 2 | 29µs | # spent 20µs (10+9) within Exporter::Tiny::BEGIN@17 which was called:
# once (10µs+9µs) by List::MoreUtils::BEGIN@12 at line 17 # spent 20µs making 1 call to Exporter::Tiny::BEGIN@17
# spent 9µs making 1 call to strict::unimport |
18 | 29 | 46µs | 29 | 208µs | my $opts = mkopt(\@args); # spent 208µs making 29 calls to Exporter::Tiny::mkopt, avg 7µs/call |
19 | |||||
20 | 29 | 2µs | my @want; | ||
21 | 29 | 3µs | my %not_want; | ||
22 | 29 | 38µs | $global_opts->{into} = caller unless exists $global_opts->{into}; | ||
23 | 29 | 17µs | $global_opts->{not} = \%not_want; | ||
24 | |||||
25 | 29 | 11µs | while (@$opts) | ||
26 | { | ||||
27 | 34 | 10µs | my $opt = shift @{$opts}; | ||
28 | 34 | 16µs | my ($name, $value) = @$opt; | ||
29 | |||||
30 | ($name =~ m{\A\!(/.+/[msixpodual]+)\z}) ? | ||||
31 | 34 | 262µs | 136 | 57µs | do { # spent 57µs making 136 calls to Exporter::Tiny::CORE:match, avg 420ns/call |
32 | my @not = $class->_exporter_expand_regexp($1, $value, $global_opts); | ||||
33 | ++$not_want{$_->[0]} for @not; | ||||
34 | } : | ||||
35 | ($name =~ m{\A\!(.+)\z}) ? | ||||
36 | (++$not_want{$1}) : | ||||
37 | ($name =~ m{\A[:-](.+)\z}) ? | ||||
38 | push(@$opts, $class->_exporter_expand_tag($1, $value, $global_opts)) : | ||||
39 | ($name =~ m{\A/.+/[msixpodual]+\z}) ? | ||||
40 | push(@$opts, $class->_exporter_expand_regexp($name, $value, $global_opts)) : | ||||
41 | # else ? | ||||
42 | push(@want, $opt); | ||||
43 | } | ||||
44 | |||||
45 | 29 | 47µs | 29 | 36µs | $class->_exporter_validate_opts($global_opts); # spent 36µs making 29 calls to Exporter::Tiny::_exporter_validate_opts, avg 1µs/call |
46 | 29 | 51µs | 29 | 1.94ms | my $permitted = $class->_exporter_permitted_regexp($global_opts); # spent 1.94ms making 29 calls to Exporter::Tiny::_exporter_permitted_regexp, avg 67µs/call |
47 | |||||
48 | 29 | 173µs | for my $wanted (@want) | ||
49 | { | ||||
50 | 34 | 18µs | next if $not_want{$wanted->[0]}; | ||
51 | |||||
52 | 34 | 95µs | 34 | 607µs | my %symbols = $class->_exporter_expand_sub(@$wanted, $global_opts, $permitted); # spent 607µs making 34 calls to Exporter::Tiny::_exporter_expand_sub, avg 18µs/call |
53 | $class->_exporter_install_sub($_, $wanted->[1], $global_opts, $symbols{$_}) | ||||
54 | 34 | 143µs | 34 | 3.12ms | for keys %symbols; # spent 3.12ms making 34 calls to Exporter::Tiny::_exporter_install_sub, avg 92µs/call |
55 | } | ||||
56 | } | ||||
57 | |||||
58 | # Called once per import, passed the "global" import options. Expected to | ||||
59 | # validate the import options and carp or croak if there are problems. Can | ||||
60 | # also take the opportunity to do other stuff if needed. | ||||
61 | # | ||||
62 | sub _exporter_validate_opts | ||||
63 | # spent 36µs within Exporter::Tiny::_exporter_validate_opts which was called 29 times, avg 1µs/call:
# 29 times (36µs+0s) by Exporter::Tiny::import at line 45, avg 1µs/call | ||||
64 | 29 | 56µs | 1; | ||
65 | } | ||||
66 | |||||
67 | # Called after expanding a tag or regexp to merge the tag's options with | ||||
68 | # any sub-specific options. | ||||
69 | sub _exporter_merge_opts | ||||
70 | { | ||||
71 | my $class = shift; | ||||
72 | my ($tag_opts, $global_opts, @stuff) = @_; | ||||
73 | |||||
74 | $tag_opts = {} unless ref($tag_opts) eq q(HASH); | ||||
75 | _croak('Cannot provide an -as option for tags') | ||||
76 | if exists $tag_opts->{-as}; | ||||
77 | |||||
78 | my $optlist = mkopt(\@stuff); | ||||
79 | for my $export (@$optlist) | ||||
80 | { | ||||
81 | next if defined($export->[1]) && ref($export->[1]) ne q(HASH); | ||||
82 | |||||
83 | my %sub_opts = ( %{ $export->[1] or {} }, %$tag_opts ); | ||||
84 | $sub_opts{-prefix} = sprintf('%s%s', $tag_opts->{-prefix}, $export->[1]{-prefix}) | ||||
85 | if exists($export->[1]{-prefix}) && exists($tag_opts->{-prefix}); | ||||
86 | $sub_opts{-suffix} = sprintf('%s%s', $export->[1]{-suffix}, $tag_opts->{-suffix}) | ||||
87 | if exists($export->[1]{-suffix}) && exists($tag_opts->{-suffix}); | ||||
88 | $export->[1] = \%sub_opts; | ||||
89 | } | ||||
90 | return @$optlist; | ||||
91 | } | ||||
92 | |||||
93 | # Given a tag name, looks it up in %EXPORT_TAGS and returns the list of | ||||
94 | # associated functions. The default implementation magically handles tags | ||||
95 | # "all" and "default". The default implementation interprets any undefined | ||||
96 | # tags as being global options. | ||||
97 | # | ||||
98 | sub _exporter_expand_tag | ||||
99 | { | ||||
100 | 2 | 142µs | 2 | 26µs | # spent 17µs (7+10) within Exporter::Tiny::BEGIN@100 which was called:
# once (7µs+10µs) by List::MoreUtils::BEGIN@12 at line 100 # spent 17µs making 1 call to Exporter::Tiny::BEGIN@100
# spent 10µs making 1 call to strict::unimport |
101 | |||||
102 | my $class = shift; | ||||
103 | my ($name, $value, $globals) = @_; | ||||
104 | my $tags = \%{"$class\::EXPORT_TAGS"}; | ||||
105 | |||||
106 | return $class->_exporter_merge_opts($value, $globals, $tags->{$name}->($class, @_)) | ||||
107 | if ref($tags->{$name}) eq q(CODE); | ||||
108 | |||||
109 | return $class->_exporter_merge_opts($value, $globals, @{$tags->{$name}}) | ||||
110 | if exists $tags->{$name}; | ||||
111 | |||||
112 | return $class->_exporter_merge_opts($value, $globals, @{"$class\::EXPORT"}, @{"$class\::EXPORT_OK"}) | ||||
113 | if $name eq 'all'; | ||||
114 | |||||
115 | return $class->_exporter_merge_opts($value, $globals, @{"$class\::EXPORT"}) | ||||
116 | if $name eq 'default'; | ||||
117 | |||||
118 | $globals->{$name} = $value || 1; | ||||
119 | return; | ||||
120 | } | ||||
121 | |||||
122 | # Given a regexp-like string, looks it up in @EXPORT_OK and returns the | ||||
123 | # list of matching functions. | ||||
124 | # | ||||
125 | sub _exporter_expand_regexp | ||||
126 | { | ||||
127 | 2 | 81µs | 2 | 26µs | # spent 17µs (7+10) within Exporter::Tiny::BEGIN@127 which was called:
# once (7µs+10µs) by List::MoreUtils::BEGIN@12 at line 127 # spent 17µs making 1 call to Exporter::Tiny::BEGIN@127
# spent 10µs making 1 call to strict::unimport |
128 | |||||
129 | my $class = shift; | ||||
130 | my ($name, $value, $globals) = @_; | ||||
131 | my $compiled = eval("qr$name"); | ||||
132 | |||||
133 | $class->_exporter_merge_opts($value, $globals, grep /$compiled/, @{"$class\::EXPORT_OK"}); | ||||
134 | } | ||||
135 | |||||
136 | # Helper for _exporter_expand_sub. Returns a regexp matching all subs in | ||||
137 | # the exporter package which are available for export. | ||||
138 | # | ||||
139 | sub _exporter_permitted_regexp | ||||
140 | # spent 1.94ms (848µs+1.10) within Exporter::Tiny::_exporter_permitted_regexp which was called 29 times, avg 67µs/call:
# 29 times (848µs+1.10ms) by Exporter::Tiny::import at line 46, avg 67µs/call | ||||
141 | 2 | 107µs | 2 | 26µs | # spent 16µs (7+9) within Exporter::Tiny::BEGIN@141 which was called:
# once (7µs+9µs) by List::MoreUtils::BEGIN@12 at line 141 # spent 16µs making 1 call to Exporter::Tiny::BEGIN@141
# spent 10µs making 1 call to strict::unimport |
142 | 29 | 9µs | my $class = shift; | ||
143 | my $re = join "|", map quotemeta, sort { | ||||
144 | length($b) <=> length($a) or $a cmp $b | ||||
145 | 29 | 1.59ms | 29 | 909µs | } @{"$class\::EXPORT"}, @{"$class\::EXPORT_OK"}; # spent 909µs making 29 calls to Exporter::Tiny::CORE:sort, avg 31µs/call |
146 | 29 | 3.26ms | 58 | 188µs | qr{^(?:$re)$}ms; # spent 146µs making 29 calls to Exporter::Tiny::CORE:regcomp, avg 5µs/call
# spent 42µs making 29 calls to Exporter::Tiny::CORE:qr, avg 1µs/call |
147 | } | ||||
148 | |||||
149 | # Given a sub name, returns a hash of subs to install (usually just one sub). | ||||
150 | # Keys are sub names, values are coderefs. | ||||
151 | # | ||||
152 | sub _exporter_expand_sub | ||||
153 | # spent 607µs (386+221) within Exporter::Tiny::_exporter_expand_sub which was called 34 times, avg 18µs/call:
# 34 times (386µs+221µs) by Exporter::Tiny::import at line 52, avg 18µs/call | ||||
154 | 34 | 10µs | my $class = shift; | ||
155 | 34 | 14µs | my ($name, $value, $globals, $permitted) = @_; | ||
156 | 34 | 7µs | $permitted ||= $class->_exporter_permitted_regexp($globals); | ||
157 | |||||
158 | 2 | 262µs | 2 | 32µs | # spent 19µs (7+12) within Exporter::Tiny::BEGIN@158 which was called:
# once (7µs+12µs) by List::MoreUtils::BEGIN@12 at line 158 # spent 19µs making 1 call to Exporter::Tiny::BEGIN@158
# spent 12µs making 1 call to strict::unimport |
159 | |||||
160 | 34 | 213µs | 68 | 105µs | if ($name =~ $permitted) # spent 62µs making 34 calls to Exporter::Tiny::CORE:match, avg 2µs/call
# spent 43µs making 34 calls to Exporter::Tiny::CORE:regcomp, avg 1µs/call |
161 | { | ||||
162 | 34 | 165µs | 34 | 77µs | my $generator = $class->can("_generate_$name"); # spent 77µs making 34 calls to UNIVERSAL::can, avg 2µs/call |
163 | 34 | 3µs | return $name => $class->$generator($name, $value, $globals) if $generator; | ||
164 | |||||
165 | 34 | 104µs | 34 | 40µs | my $sub = $class->can($name); # spent 40µs making 34 calls to UNIVERSAL::can, avg 1µs/call |
166 | 34 | 90µs | return $name => $sub if $sub; | ||
167 | } | ||||
168 | |||||
169 | $class->_exporter_fail(@_); | ||||
170 | } | ||||
171 | |||||
172 | # Called by _exporter_expand_sub if it is unable to generate a key-value | ||||
173 | # pair for a sub. | ||||
174 | # | ||||
175 | sub _exporter_fail | ||||
176 | { | ||||
177 | my $class = shift; | ||||
178 | my ($name, $value, $globals) = @_; | ||||
179 | _croak("Could not find sub '$name' to export in package '$class'"); | ||||
180 | } | ||||
181 | |||||
182 | # Actually performs the installation of the sub into the target package. This | ||||
183 | # also handles renaming the sub. | ||||
184 | # | ||||
185 | sub _exporter_install_sub | ||||
186 | # spent 3.12ms (2.34+776µs) within Exporter::Tiny::_exporter_install_sub which was called 34 times, avg 92µs/call:
# 34 times (2.34ms+776µs) by Exporter::Tiny::import at line 54, avg 92µs/call | ||||
187 | 34 | 9µs | my $class = shift; | ||
188 | 34 | 16µs | my ($name, $value, $globals, $sym) = @_; | ||
189 | |||||
190 | 34 | 11µs | my $into = $globals->{into}; | ||
191 | 34 | 13µs | my $installer = $globals->{installer} || $globals->{exporter}; | ||
192 | |||||
193 | 34 | 24µs | $name = $value->{-as} || $name; | ||
194 | 34 | 13µs | unless (ref($name) eq q(SCALAR)) | ||
195 | { | ||||
196 | 34 | 64µs | my ($prefix) = grep defined, $value->{-prefix}, $globals->{prefix}, q(); | ||
197 | 34 | 38µs | my ($suffix) = grep defined, $value->{-suffix}, $globals->{suffix}, q(); | ||
198 | 34 | 24µs | $name = "$prefix$name$suffix"; | ||
199 | } | ||||
200 | |||||
201 | 34 | 4µs | return $installer->($globals, [$name, $sym]) if $installer; | ||
202 | 34 | 7µs | return ($$name = $sym) if ref($name) eq q(SCALAR); | ||
203 | 34 | 3µs | return ($into->{$name} = $sym) if ref($into) eq q(HASH); | ||
204 | |||||
205 | 34 | 74µs | require B; | ||
206 | 34 | 318µs | 34 | 82µs | for (grep ref, $into->can($name)) # spent 82µs making 34 calls to UNIVERSAL::can, avg 2µs/call |
207 | { | ||||
208 | my $stash = B::svref_2object($_)->STASH; | ||||
209 | next unless $stash->can("NAME"); | ||||
210 | $stash->NAME eq $into | ||||
211 | and _croak("Refusing to overwrite local sub '$name' with export from $class"); | ||||
212 | } | ||||
213 | |||||
214 | 2 | 236µs | 2 | 27µs | # spent 17µs (7+10) within Exporter::Tiny::BEGIN@214 which was called:
# once (7µs+10µs) by List::MoreUtils::BEGIN@12 at line 214 # spent 17µs making 1 call to Exporter::Tiny::BEGIN@214
# spent 10µs making 1 call to strict::unimport |
215 | 34 | 146µs | *{"$into\::$name"} = $sym; | ||
216 | } | ||||
217 | |||||
218 | sub mkopt | ||||
219 | # spent 208µs within Exporter::Tiny::mkopt which was called 29 times, avg 7µs/call:
# 29 times (208µs+0s) by Exporter::Tiny::import at line 18, avg 7µs/call | ||||
220 | 29 | 8µs | my $in = shift or return []; | ||
221 | 29 | 5µs | my @out; | ||
222 | |||||
223 | 29 | 14µs | $in = [map(($_ => ref($in->{$_}) ? $in->{$_} : ()), sort keys %$in)] | ||
224 | if ref($in) eq q(HASH); | ||||
225 | |||||
226 | 29 | 41µs | for (my $i = 0; $i < @$in; $i++) | ||
227 | { | ||||
228 | 34 | 13µs | my $k = $in->[$i]; | ||
229 | 34 | 2µs | my $v; | ||
230 | |||||
231 | 34 | 19µs | ($i == $#$in) ? ($v = undef) : | ||
232 | !defined($in->[$i+1]) ? (++$i, ($v = undef)) : | ||||
233 | !ref($in->[$i+1]) ? ($v = undef) : | ||||
234 | ($v = $in->[++$i]); | ||||
235 | |||||
236 | 34 | 34µs | push @out, [ $k => $v ]; | ||
237 | } | ||||
238 | |||||
239 | 29 | 93µs | \@out; | ||
240 | } | ||||
241 | |||||
242 | sub mkopt_hash | ||||
243 | { | ||||
244 | my $in = shift or return; | ||||
245 | my %out = map +($_->[0] => $_->[1]), @{ mkopt($in) }; | ||||
246 | \%out; | ||||
247 | } | ||||
248 | |||||
249 | 1 | 4µs | 1; | ||
250 | |||||
251 | __END__ | ||||
sub Exporter::Tiny::CORE:match; # opcode | |||||
# spent 42µs within Exporter::Tiny::CORE:qr which was called 29 times, avg 1µs/call:
# 29 times (42µs+0s) by Exporter::Tiny::_exporter_permitted_regexp at line 146, avg 1µs/call | |||||
sub Exporter::Tiny::CORE:regcomp; # opcode | |||||
# spent 909µs within Exporter::Tiny::CORE:sort which was called 29 times, avg 31µs/call:
# 29 times (909µs+0s) by Exporter::Tiny::_exporter_permitted_regexp at line 145, avg 31µs/call |