← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:10 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Exporter/Tiny.pm
StatementsExecuted 1784 statements in 8.97ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2929294.02ms10.00msExporter::Tiny::::importExporter::Tiny::import
34112.34ms3.12msExporter::Tiny::::_exporter_install_subExporter::Tiny::_exporter_install_sub
2911909┬Ás909┬ÁsExporter::Tiny::::CORE:sortExporter::Tiny::CORE:sort (opcode)
2911848┬Ás1.94msExporter::Tiny::::_exporter_permitted_regexpExporter::Tiny::_exporter_permitted_regexp
3411386┬Ás607┬ÁsExporter::Tiny::::_exporter_expand_subExporter::Tiny::_exporter_expand_sub
2911208┬Ás208┬ÁsExporter::Tiny::::mkoptExporter::Tiny::mkopt
6321188┬Ás188┬ÁsExporter::Tiny::::CORE:regcompExporter::Tiny::CORE:regcomp (opcode)
17021119┬Ás119┬ÁsExporter::Tiny::::CORE:matchExporter::Tiny::CORE:match (opcode)
291142┬Ás42┬ÁsExporter::Tiny::::CORE:qrExporter::Tiny::CORE:qr (opcode)
291136┬Ás36┬ÁsExporter::Tiny::::_exporter_validate_optsExporter::Tiny::_exporter_validate_opts
11114┬Ás14┬ÁsExporter::Tiny::::BEGIN@3Exporter::Tiny::BEGIN@3
11110┬Ás20┬ÁsExporter::Tiny::::BEGIN@17Exporter::Tiny::BEGIN@17
1117┬Ás17┬ÁsExporter::Tiny::::BEGIN@214Exporter::Tiny::BEGIN@214
1117┬Ás17┬ÁsExporter::Tiny::::BEGIN@100Exporter::Tiny::BEGIN@100
1117┬Ás17┬ÁsExporter::Tiny::::BEGIN@127Exporter::Tiny::BEGIN@127
1117┬Ás24┬ÁsExporter::Tiny::::BEGIN@5.2Exporter::Tiny::BEGIN@5.2
1117┬Ás16┬ÁsExporter::Tiny::::BEGIN@141Exporter::Tiny::BEGIN@141
1117┬Ás19┬ÁsExporter::Tiny::::BEGIN@158Exporter::Tiny::BEGIN@158
1116┬Ás10┬ÁsExporter::Tiny::::BEGIN@5Exporter::Tiny::BEGIN@5
1116┬Ás17┬ÁsExporter::Tiny::::BEGIN@4Exporter::Tiny::BEGIN@4
0000s0sExporter::Tiny::::_croakExporter::Tiny::_croak
0000s0sExporter::Tiny::::_exporter_expand_regexpExporter::Tiny::_exporter_expand_regexp
0000s0sExporter::Tiny::::_exporter_expand_tagExporter::Tiny::_exporter_expand_tag
0000s0sExporter::Tiny::::_exporter_failExporter::Tiny::_exporter_fail
0000s0sExporter::Tiny::::_exporter_merge_optsExporter::Tiny::_exporter_merge_opts
0000s0sExporter::Tiny::::mkopt_hashExporter::Tiny::mkopt_hash
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Exporter::Tiny;
2
3235┬Ás114┬Ás
# spent 14┬Ás within Exporter::Tiny::BEGIN@3 which was called: # once (14┬Ás+0s) by List::MoreUtils::BEGIN@12 at line 3
use 5.006001;
# spent 14┬Ás making 1 call to Exporter::Tiny::BEGIN@3
4217┬Ás228┬Á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
use strict;
# spent 17┬Ás making 1 call to Exporter::Tiny::BEGIN@4 # spent 11┬Ás making 1 call to strict::import
54126┬Ás456┬Ás
# spent 24┬Ás (7+18) within Exporter::Tiny::BEGIN@5.2 which was called: # once (7┬Ás+18┬Ás) by List::MoreUtils::BEGIN@12 at line 5 # spent 10┬Ás (6+4) within Exporter::Tiny::BEGIN@5 which was called: # once (6┬Ás+4┬Ás) by List::MoreUtils::BEGIN@12 at line 5
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
71600nsour $AUTHORITY = 'cpan:TOBYINK';
81200nsour $VERSION = '0.038';
911┬Ásour @EXPORT_OK = qw< mkopt mkopt_hash _croak >;
10
11sub _croak ($;@) { require Carp; my $fmt = shift; @_ = sprintf($fmt, @_); goto \&Carp::croak }
12
13sub 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
{
152914┬Ás my $class = shift;
162941┬Ás my $global_opts = +{ @_ && ref($_[0]) eq q(HASH) ? %{+shift} : () };
1760450┬Ás229┬Á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
my @args = do { no strict qw(refs); @_ ? @_ : @{"$class\::EXPORT"} };
# spent 20┬Ás making 1 call to Exporter::Tiny::BEGIN@17 # spent 9┬Ás making 1 call to strict::unimport
182946┬Ás29208┬Ás my $opts = mkopt(\@args);
# spent 208┬Ás making 29 calls to Exporter::Tiny::mkopt, avg 7┬Ás/call
19
20292┬Ás my @want;
21293┬Ás my %not_want;
222938┬Ás $global_opts->{into} = caller unless exists $global_opts->{into};
232917┬Ás $global_opts->{not} = \%not_want;
24
252911┬Ás while (@$opts)
26 {
273410┬Ás my $opt = shift @{$opts};
283416┬Ás my ($name, $value) = @$opt;
29
30 ($name =~ m{\A\!(/.+/[msixpodual]+)\z}) ?
3134262┬Ás13657┬Á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
452947┬Ás2936┬Ás $class->_exporter_validate_opts($global_opts);
# spent 36┬Ás making 29 calls to Exporter::Tiny::_exporter_validate_opts, avg 1┬Ás/call
462951┬Ás291.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
4829173┬Ás for my $wanted (@want)
49 {
503418┬Ás next if $not_want{$wanted->[0]};
51
523495┬Ás34607┬Á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{$_})
5434143┬Ás343.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#
62sub _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
{
642956┬Ás 1;
65}
66
67# Called after expanding a tag or regexp to merge the tag's options with
68# any sub-specific options.
69sub _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#
98sub _exporter_expand_tag
99{
1002142┬Ás226┬Á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
no strict qw(refs);
# 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#
125sub _exporter_expand_regexp
126{
127281┬Ás226┬Á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
no strict qw(refs);
# 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#
139sub _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
{
1412107┬Ás226┬Á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
no strict qw(refs);
# spent 16┬Ás making 1 call to Exporter::Tiny::BEGIN@141 # spent 10┬Ás making 1 call to strict::unimport
142299┬Ás my $class = shift;
143 my $re = join "|", map quotemeta, sort {
144 length($b) <=> length($a) or $a cmp $b
145291.59ms29909┬Ás } @{"$class\::EXPORT"}, @{"$class\::EXPORT_OK"};
# spent 909┬Ás making 29 calls to Exporter::Tiny::CORE:sort, avg 31┬Ás/call
146293.26ms58188┬Á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#
152sub _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
{
1543410┬Ás my $class = shift;
1553414┬Ás my ($name, $value, $globals, $permitted) = @_;
156347┬Ás $permitted ||= $class->_exporter_permitted_regexp($globals);
157
1582262┬Ás232┬Á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
no strict qw(refs);
# spent 19┬Ás making 1 call to Exporter::Tiny::BEGIN@158 # spent 12┬Ás making 1 call to strict::unimport
159
16034213┬Ás68105┬Á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 {
16234165┬Ás3477┬Ás my $generator = $class->can("_generate_$name");
# spent 77┬Ás making 34 calls to UNIVERSAL::can, avg 2┬Ás/call
163343┬Ás return $name => $class->$generator($name, $value, $globals) if $generator;
164
16534104┬Ás3440┬Ás my $sub = $class->can($name);
# spent 40┬Ás making 34 calls to UNIVERSAL::can, avg 1┬Ás/call
1663490┬Á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#
175sub _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#
185sub _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
{
187349┬Ás my $class = shift;
1883416┬Ás my ($name, $value, $globals, $sym) = @_;
189
1903411┬Ás my $into = $globals->{into};
1913413┬Ás my $installer = $globals->{installer} || $globals->{exporter};
192
1933424┬Ás $name = $value->{-as} || $name;
1943413┬Ás unless (ref($name) eq q(SCALAR))
195 {
1963464┬Ás my ($prefix) = grep defined, $value->{-prefix}, $globals->{prefix}, q();
1973438┬Ás my ($suffix) = grep defined, $value->{-suffix}, $globals->{suffix}, q();
1983424┬Ás $name = "$prefix$name$suffix";
199 }
200
201344┬Ás return $installer->($globals, [$name, $sym]) if $installer;
202347┬Ás return ($$name = $sym) if ref($name) eq q(SCALAR);
203343┬Ás return ($into->{$name} = $sym) if ref($into) eq q(HASH);
204
2053474┬Ás require B;
20634318┬Ás3482┬Á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
2142236┬Ás227┬Á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
no strict qw(refs);
# spent 17┬Ás making 1 call to Exporter::Tiny::BEGIN@214 # spent 10┬Ás making 1 call to strict::unimport
21534146┬Ás *{"$into\::$name"} = $sym;
216}
217
218sub 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
{
220298┬Ás my $in = shift or return [];
221295┬Ás my @out;
222
2232914┬Ás $in = [map(($_ => ref($in->{$_}) ? $in->{$_} : ()), sort keys %$in)]
224 if ref($in) eq q(HASH);
225
2262941┬Ás for (my $i = 0; $i < @$in; $i++)
227 {
2283413┬Ás my $k = $in->[$i];
229342┬Ás my $v;
230
2313419┬Á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
2363434┬Ás push @out, [ $k => $v ];
237 }
238
2392993┬Ás \@out;
240}
241
242sub mkopt_hash
243{
244 my $in = shift or return;
245 my %out = map +($_->[0] => $_->[1]), @{ mkopt($in) };
246 \%out;
247}
248
24914┬Ás1;
250
251__END__
 
# spent 119┬Ás within Exporter::Tiny::CORE:match which was called 170 times, avg 701ns/call: # 136 times (57┬Ás+0s) by Exporter::Tiny::import at line 31, avg 420ns/call # 34 times (62┬Ás+0s) by Exporter::Tiny::_exporter_expand_sub at line 160, avg 2┬Ás/call
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:qr; # opcode
# spent 188┬Ás within Exporter::Tiny::CORE:regcomp which was called 63 times, avg 3┬Ás/call: # 34 times (43┬Ás+0s) by Exporter::Tiny::_exporter_expand_sub at line 160, avg 1┬Ás/call # 29 times (146┬Ás+0s) by Exporter::Tiny::_exporter_permitted_regexp at line 146, avg 5┬Á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
sub Exporter::Tiny::CORE:sort; # opcode