| Filename | /home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/x86_64-linux/Mouse/Exporter.pm |
| Statements | Executed 1944 statements in 8.31ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 40 | 35 | 30 | 2.02ms | 8.57ms | Mouse::Exporter::do_import |
| 1 | 1 | 1 | 1.82ms | 1.93ms | Mouse::Exporter::BEGIN@5 |
| 5 | 1 | 1 | 1.01ms | 1.03ms | Mouse::Exporter::build_import_methods |
| 11 | 11 | 9 | 835µs | 899µs | Mouse::Exporter::do_unimport |
| 51 | 2 | 1 | 302µs | 302µs | Mouse::Exporter::_get_caller_package |
| 5 | 5 | 5 | 125µs | 1.25ms | Mouse::Exporter::setup_import_methods |
| 5 | 5 | 5 | 54µs | 54µs | Mouse::Exporter::import |
| 30 | 1 | 1 | 51µs | 51µs | Mouse::Exporter::CORE:subst (opcode) |
| 1 | 1 | 1 | 27µs | 34µs | Mouse::Exporter::BEGIN@2 |
| 1 | 1 | 1 | 16µs | 32µs | Mouse::Exporter::BEGIN@3 |
| 1 | 1 | 1 | 13µs | 38µs | Mouse::Exporter::BEGIN@231 |
| 1 | 1 | 1 | 12µs | 35µs | Mouse::Exporter::BEGIN@96 |
| 1 | 1 | 1 | 11µs | 30µs | Mouse::Exporter::BEGIN@10 |
| 1 | 1 | 1 | 10µs | 52µs | Mouse::Exporter::BEGIN@13 |
| 0 | 0 | 0 | 0s | 0s | Mouse::Exporter::__ANON__[:43] |
| 0 | 0 | 0 | 0s | 0s | Mouse::Exporter::__ANON__[:47] |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::export |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::export_to_level |
| 0 | 0 | 0 | 0s | 0s | Mouse::Util::TypeConstraints::export |
| 0 | 0 | 0 | 0s | 0s | Mouse::Util::TypeConstraints::export_to_level |
| 0 | 0 | 0 | 0s | 0s | Mouse::export |
| 0 | 0 | 0 | 0s | 0s | Mouse::export_to_level |
| 0 | 0 | 0 | 0s | 0s | MouseX::StrictConstructor::export |
| 0 | 0 | 0 | 0s | 0s | MouseX::StrictConstructor::export_to_level |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Mouse::Exporter; | ||||
| 2 | 2 | 29µs | 2 | 41µs | # spent 34µs (27+7) within Mouse::Exporter::BEGIN@2 which was called:
# once (27µs+7µs) by Mouse::BEGIN@4 at line 2 # spent 34µs making 1 call to Mouse::Exporter::BEGIN@2
# spent 7µs making 1 call to strict::import |
| 3 | 2 | 34µs | 2 | 47µs | # spent 32µs (16+15) within Mouse::Exporter::BEGIN@3 which was called:
# once (16µs+15µs) by Mouse::BEGIN@4 at line 3 # spent 32µs making 1 call to Mouse::Exporter::BEGIN@3
# spent 15µs making 1 call to warnings::import |
| 4 | |||||
| 5 | 2 | 1.78ms | 1 | 1.93ms | # spent 1.93ms (1.82+119µs) within Mouse::Exporter::BEGIN@5 which was called:
# once (1.82ms+119µs) by Mouse::BEGIN@4 at line 5 # spent 1.93ms making 1 call to Mouse::Exporter::BEGIN@5 |
| 6 | |||||
| 7 | 1 | 800ns | my %SPEC; | ||
| 8 | |||||
| 9 | 1 | 600ns | my $strict_bits; | ||
| 10 | 1 | 36µs | 2 | 50µs | # spent 30µs (11+19) within Mouse::Exporter::BEGIN@10 which was called:
# once (11µs+19µs) by Mouse::BEGIN@4 at line 10 # spent 30µs making 1 call to Mouse::Exporter::BEGIN@10
# spent 19µs making 1 call to strict::bits |
| 11 | |||||
| 12 | 1 | 1µs | my $warnings_extra_bits; | ||
| 13 | 1 | 339µs | 2 | 93µs | # spent 52µs (10+41) within Mouse::Exporter::BEGIN@13 which was called:
# once (10µs+41µs) by Mouse::BEGIN@4 at line 13 # spent 52µs making 1 call to Mouse::Exporter::BEGIN@13
# spent 41µs making 1 call to warnings::bits |
| 14 | |||||
| 15 | # it must be "require", because Mouse::Util depends on Mouse::Exporter, | ||||
| 16 | # which depends on Mouse::Util::import() | ||||
| 17 | 1 | 124µs | require Mouse::Util; | ||
| 18 | |||||
| 19 | # spent 54µs within Mouse::Exporter::import which was called 5 times, avg 11µs/call:
# once (13µs+0s) by Mouse::Util::BEGIN@2 at line 2 of Mouse/Util.pm
# once (12µs+0s) by MouseX::StrictConstructor::BEGIN@5 at line 5 of MouseX/StrictConstructor.pm
# once (10µs+0s) by Mouse::BEGIN@4 at line 4 of Mouse.pm
# once (10µs+0s) by Mouse::Role::BEGIN@2 at line 2 of Mouse/Role.pm
# once (9µs+0s) by Mouse::Util::TypeConstraints::BEGIN@5 at line 5 of Mouse/Util/TypeConstraints.pm | ||||
| 20 | # strict->import; | ||||
| 21 | 20 | 65µs | $^H |= $strict_bits; | ||
| 22 | # warnings->import('all', FATAL => 'recursion'); | ||||
| 23 | ${^WARNING_BITS} |= $warnings::Bits{all}; | ||||
| 24 | ${^WARNING_BITS} |= $warnings_extra_bits; | ||||
| 25 | return; | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | |||||
| 29 | # spent 1.25ms (125µs+1.12) within Mouse::Exporter::setup_import_methods which was called 5 times, avg 250µs/call:
# once (29µs+375µs) by Mouse::Util::BEGIN@20 at line 22 of Mouse/Util.pm
# once (26µs+254µs) by Mouse::BEGIN@18 at line 10 of Mouse/Util/TypeConstraints.pm
# once (23µs+222µs) by MouseX::Getopt::BEGIN@10 at line 11 of Mouse/Role.pm
# once (22µs+204µs) by hailo::BEGIN@6 at line 20 of Mouse.pm
# once (25µs+69µs) by Any::Moose::_install_module at line 9 of MouseX/StrictConstructor.pm | ||||
| 30 | 25 | 175µs | my($class, %args) = @_; | ||
| 31 | |||||
| 32 | my $exporting_package = $args{exporting_package} ||= caller(); | ||||
| 33 | |||||
| 34 | 5 | 1.03ms | my($import, $unimport) = $class->build_import_methods(%args); # spent 1.03ms making 5 calls to Mouse::Exporter::build_import_methods, avg 207µs/call | ||
| 35 | |||||
| 36 | Mouse::Util::install_subroutines($exporting_package, | ||||
| 37 | import => $import, | ||||
| 38 | unimport => $unimport, | ||||
| 39 | |||||
| 40 | export_to_level => sub { | ||||
| 41 | my($package, $level, undef, @args) = @_; # the third argument is redundant | ||||
| 42 | $package->import({ into_level => $level + 1 }, @args); | ||||
| 43 | }, | ||||
| 44 | export => sub { | ||||
| 45 | my($package, $into, @args) = @_; | ||||
| 46 | $package->import({ into => $into }, @args); | ||||
| 47 | }, | ||||
| 48 | 5 | 90µs | ); # spent 90µs making 5 calls to Mouse::Util::install_subroutines, avg 18µs/call | ||
| 49 | return; | ||||
| 50 | } | ||||
| 51 | |||||
| 52 | # spent 1.03ms (1.01+25µs) within Mouse::Exporter::build_import_methods which was called 5 times, avg 207µs/call:
# 5 times (1.01ms+25µs) by Mouse::Exporter::setup_import_methods at line 34, avg 207µs/call | ||||
| 53 | 80 | 151µs | my($self, %args) = @_; | ||
| 54 | |||||
| 55 | my $exporting_package = $args{exporting_package} ||= caller(); | ||||
| 56 | |||||
| 57 | $SPEC{$exporting_package} = \%args; | ||||
| 58 | |||||
| 59 | # canonicalize args | ||||
| 60 | my @export_from; | ||||
| 61 | 5 | 9µs | if($args{also}){ | ||
| 62 | my %seen; | ||||
| 63 | my @stack = ($exporting_package); | ||||
| 64 | |||||
| 65 | while(my $current = shift @stack){ | ||||
| 66 | push @export_from, $current; | ||||
| 67 | |||||
| 68 | my $also = $SPEC{$current}{also} or next; | ||||
| 69 | push @stack, grep{ !$seen{$_}++ } ref($also) ? @{ $also } : $also; | ||||
| 70 | } | ||||
| 71 | } | ||||
| 72 | else{ | ||||
| 73 | @export_from = ($exporting_package); | ||||
| 74 | } | ||||
| 75 | |||||
| 76 | my %exports; | ||||
| 77 | my @removables; | ||||
| 78 | my @all; | ||||
| 79 | |||||
| 80 | my @init_meta_methods; | ||||
| 81 | |||||
| 82 | foreach my $package(@export_from){ | ||||
| 83 | 15 | 99µs | my $spec = $SPEC{$package} or next; | ||
| 84 | |||||
| 85 | 4 | 10µs | if(my $as_is = $spec->{as_is}){ | ||
| 86 | foreach my $thingy (@{$as_is}){ | ||||
| 87 | 285 | 455µs | my($code_package, $code_name, $code); | ||
| 88 | |||||
| 89 | 167 | 299µs | if(ref($thingy)){ | ||
| 90 | $code = $thingy; | ||||
| 91 | 4 | 9µs | ($code_package, $code_name) = Mouse::Util::get_code_info($code); # spent 9µs making 4 calls to Mouse::Util::get_code_info, avg 2µs/call | ||
| 92 | } | ||||
| 93 | else{ | ||||
| 94 | $code_package = $package; | ||||
| 95 | $code_name = $thingy; | ||||
| 96 | 2 | 680µs | 2 | 59µs | # spent 35µs (12+24) within Mouse::Exporter::BEGIN@96 which was called:
# once (12µs+24µs) by Mouse::BEGIN@4 at line 96 # spent 35µs making 1 call to Mouse::Exporter::BEGIN@96
# spent 24µs making 1 call to strict::unimport |
| 97 | $code = \&{ $code_package . '::' . $code_name }; | ||||
| 98 | } | ||||
| 99 | |||||
| 100 | push @all, $code_name; | ||||
| 101 | $exports{$code_name} = $code; | ||||
| 102 | if($code_package eq $package){ | ||||
| 103 | push @removables, $code_name; | ||||
| 104 | } | ||||
| 105 | } | ||||
| 106 | } | ||||
| 107 | |||||
| 108 | 5 | 16µs | if(my $init_meta = $package->can('init_meta')){ # spent 16µs making 5 calls to UNIVERSAL::can, avg 3µs/call | ||
| 109 | if(!grep{ $_ == $init_meta } @init_meta_methods){ | ||||
| 110 | push @init_meta_methods, $init_meta; | ||||
| 111 | } | ||||
| 112 | } | ||||
| 113 | } | ||||
| 114 | $args{EXPORTS} = \%exports; | ||||
| 115 | $args{REMOVABLES} = \@removables; | ||||
| 116 | |||||
| 117 | $args{groups}{all} ||= \@all; | ||||
| 118 | |||||
| 119 | 11 | 17µs | if(my $default_list = $args{groups}{default}){ | ||
| 120 | my %default; | ||||
| 121 | foreach my $keyword(@{$default_list}){ | ||||
| 122 | $default{$keyword} = $exports{$keyword} | ||||
| 123 | || Carp::confess(qq{The $exporting_package package does not export "$keyword"}); | ||||
| 124 | } | ||||
| 125 | $args{DEFAULT} = \%default; | ||||
| 126 | } | ||||
| 127 | else{ | ||||
| 128 | $args{groups}{default} ||= \@all; | ||||
| 129 | $args{DEFAULT} = $args{EXPORTS}; | ||||
| 130 | } | ||||
| 131 | |||||
| 132 | if(@init_meta_methods){ | ||||
| 133 | $args{INIT_META} = \@init_meta_methods; | ||||
| 134 | } | ||||
| 135 | |||||
| 136 | return (\&do_import, \&do_unimport); | ||||
| 137 | } | ||||
| 138 | |||||
| 139 | |||||
| 140 | # the entity of general import() | ||||
| 141 | # spent 8.57ms (2.02+6.56) within Mouse::Exporter::do_import which was called 40 times, avg 214µs/call:
# 2 times (97µs+489µs) by Any::Moose::_install_module at line 2 of (eval 83)[Any/Moose.pm:152], avg 293µs/call
# 2 times (107µs+478µs) by Any::Moose::_install_module at line 2 of (eval 33)[Any/Moose.pm:152], avg 292µs/call
# 2 times (91µs+459µs) by Any::Moose::_install_module at line 2 of (eval 96)[Any/Moose.pm:152], avg 275µs/call
# 2 times (95µs+432µs) by Any::Moose::_install_module at line 2 of (eval 10)[Any/Moose.pm:152], avg 263µs/call
# 2 times (86µs+416µs) by Any::Moose::_install_module at line 2 of (eval 85)[Any/Moose.pm:152], avg 251µs/call
# once (56µs+435µs) by Any::Moose::_install_module at line 2 of (eval 93)[Any/Moose.pm:152]
# once (48µs+413µs) by Any::Moose::_install_module at line 2 of (eval 9)[Any/Moose.pm:152]
# once (75µs+344µs) by MouseX::Getopt::OptionTypeMap::BEGIN@10 at line 10 of MouseX/Getopt/OptionTypeMap.pm
# once (45µs+340µs) by MouseX::Getopt::Meta::Attribute::BEGIN@10 at line 10 of MouseX/Getopt/Meta/Attribute.pm
# once (45µs+336µs) by MouseX::Getopt::Meta::Attribute::NoGetopt::BEGIN@10 at line 10 of MouseX/Getopt/Meta/Attribute/NoGetopt.pm
# once (53µs+318µs) by MouseX::Getopt::Basic::BEGIN@10 at line 10 of MouseX/Getopt/Basic.pm
# once (54µs+253µs) by Any::Moose::_install_module at line 2 of (eval 87)[Any/Moose.pm:152]
# once (55µs+242µs) by MouseX::Getopt::Dashes::BEGIN@10 at line 10 of MouseX/Getopt/Dashes.pm
# once (43µs+243µs) by MouseX::Getopt::Meta::Attribute::Trait::NoGetopt::BEGIN@10 at line 10 of MouseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm
# once (42µs+242µs) by MouseX::Getopt::BEGIN@10 at line 10 of MouseX/Getopt.pm
# once (43µs+234µs) by MouseX::Getopt::Meta::Attribute::Trait::BEGIN@10 at line 10 of MouseX/Getopt/Meta/Attribute/Trait.pm
# once (41µs+226µs) by MouseX::Getopt::GLD::BEGIN@10 at line 10 of MouseX/Getopt/GLD.pm
# once (56µs+139µs) by Any::Moose::_install_module at line 2 of (eval 111)[Any/Moose.pm:152]
# once (49µs+129µs) by Any::Moose::_install_module at line 2 of (eval 94)[Any/Moose.pm:152]
# once (48µs+110µs) by Any::Moose::_install_module at line 2 of (eval 88)[Any/Moose.pm:152]
# once (74µs+25µs) by Mouse::Util::BEGIN@20 at line 65 of Mouse.pm
# once (74µs+24µs) by Mouse::Meta::Module::BEGIN@2 at line 2 of Mouse/Meta/Module.pm
# once (72µs+19µs) by Mouse::Object::BEGIN@2 at line 2 of Mouse/Object.pm
# once (60µs+18µs) by Mouse::Meta::Role::Application::BEGIN@2 at line 2 of Mouse/Meta/Role/Application.pm
# once (60µs+18µs) by Mouse::Meta::Class::BEGIN@2 at line 2 of Mouse/Meta/Class.pm
# once (56µs+22µs) by Mouse::Meta::TypeConstraint::BEGIN@2 at line 2 of Mouse/Meta/TypeConstraint.pm
# once (60µs+16µs) by Mouse::Util::BEGIN@20 at line 67 of Mouse.pm
# once (58µs+18µs) by Mouse::Meta::Role::BEGIN@2 at line 2 of Mouse/Meta/Role.pm
# once (56µs+16µs) by Mouse::Meta::Attribute::BEGIN@2 at line 2 of Mouse/Meta/Attribute.pm
# once (54µs+16µs) by Mouse::Util::BEGIN@20 at line 66 of Mouse.pm
# once (30µs+29µs) by MouseX::Getopt::Meta::Attribute::BEGIN@11 at line 11 of MouseX/Getopt/Meta/Attribute.pm
# once (30µs+28µs) by MouseX::Getopt::Meta::Attribute::Trait::BEGIN@11 at line 11 of MouseX/Getopt/Meta/Attribute/Trait.pm
# once (45µs+12µs) by MouseX::Getopt::OptionTypeMap::BEGIN@11 at line 11 of MouseX/Getopt/OptionTypeMap.pm
# once (31µs+9µs) by Mouse::Meta::Role::Composite::BEGIN@2 at line 2 of Mouse/Meta/Role/Composite.pm
# once (31µs+7µs) by Mouse::Util::TypeConstraints::BEGIN@2 at line 2 of Mouse/Util/TypeConstraints.pm | ||||
| 142 | 480 | 1.18ms | my($package, @args) = @_; | ||
| 143 | |||||
| 144 | my $spec = $SPEC{$package} | ||||
| 145 | || Carp::confess("The package $package package does not use Mouse::Exporter"); | ||||
| 146 | |||||
| 147 | 40 | 239µs | my $into = _get_caller_package(ref($args[0]) ? shift @args : undef); # spent 239µs making 40 calls to Mouse::Exporter::_get_caller_package, avg 6µs/call | ||
| 148 | |||||
| 149 | my @exports; | ||||
| 150 | my @traits; | ||||
| 151 | |||||
| 152 | while(@args){ | ||||
| 153 | 30 | 190µs | my $arg = shift @args; | ||
| 154 | 24 | 47µs | 30 | 51µs | if($arg =~ s/^-//){ # spent 51µs making 30 calls to Mouse::Exporter::CORE:subst, avg 2µs/call |
| 155 | if($arg eq 'traits'){ | ||||
| 156 | push @traits, ref($args[0]) ? @{shift(@args)} : shift(@args); | ||||
| 157 | } | ||||
| 158 | else { | ||||
| 159 | Mouse::Util::not_supported("-$arg"); | ||||
| 160 | } | ||||
| 161 | } | ||||
| 162 | elsif($arg =~ s/^://){ | ||||
| 163 | my $group = $spec->{groups}{$arg} | ||||
| 164 | || Carp::confess(qq{The $package package does not export the group "$arg"}); | ||||
| 165 | push @exports, @{$group}; | ||||
| 166 | } | ||||
| 167 | else{ | ||||
| 168 | push @exports, $arg; | ||||
| 169 | } | ||||
| 170 | } | ||||
| 171 | |||||
| 172 | # strict->import; | ||||
| 173 | $^H |= $strict_bits; | ||||
| 174 | # warnings->import('all', FATAL => 'recursion'); | ||||
| 175 | ${^WARNING_BITS} |= $warnings::Bits{all}; | ||||
| 176 | ${^WARNING_BITS} |= $warnings_extra_bits; | ||||
| 177 | |||||
| 178 | 75 | 138µs | if($spec->{INIT_META}){ | ||
| 179 | my $meta; | ||||
| 180 | foreach my $init_meta(@{$spec->{INIT_META}}){ | ||||
| 181 | 25 | 163µs | 25 | 5.74ms | $meta = $package->$init_meta(for_class => $into); # spent 3.42ms making 10 calls to Mouse::init_meta, avg 342µs/call
# spent 1.87ms making 10 calls to Mouse::Role::init_meta, avg 187µs/call
# spent 456µs making 5 calls to MouseX::StrictConstructor::init_meta, avg 91µs/call |
| 182 | } | ||||
| 183 | |||||
| 184 | if(@traits){ | ||||
| 185 | my $type = (split /::/, ref $meta)[-1]; # e.g. "Class" for "My::Meta::Class" | ||||
| 186 | @traits = | ||||
| 187 | map{ | ||||
| 188 | ref($_) ? $_ | ||||
| 189 | : Mouse::Util::resolve_metaclass_alias($type => $_, trait => 1) | ||||
| 190 | } @traits; | ||||
| 191 | |||||
| 192 | require Mouse::Util::MetaRole; | ||||
| 193 | Mouse::Util::MetaRole::apply_metaroles( | ||||
| 194 | for => $into, | ||||
| 195 | Mouse::Util::is_a_metarole($into->meta) | ||||
| 196 | ? (role_metaroles => { role => \@traits }) | ||||
| 197 | : (class_metaroles => { class => \@traits }), | ||||
| 198 | ); | ||||
| 199 | } | ||||
| 200 | } | ||||
| 201 | elsif(@traits){ | ||||
| 202 | Carp::confess("Cannot provide traits when $package does not have an init_meta() method"); | ||||
| 203 | } | ||||
| 204 | |||||
| 205 | 64 | 786µs | if(@exports){ | ||
| 206 | my @export_table; | ||||
| 207 | foreach my $keyword(@exports){ | ||||
| 208 | 42 | 115µs | push @export_table, | ||
| 209 | $keyword => ($spec->{EXPORTS}{$keyword} | ||||
| 210 | || Carp::confess(qq{The $package package does not export "$keyword"}) | ||||
| 211 | ); | ||||
| 212 | } | ||||
| 213 | 12 | 102µs | Mouse::Util::install_subroutines($into, @export_table); # spent 102µs making 12 calls to Mouse::Util::install_subroutines, avg 9µs/call | ||
| 214 | } | ||||
| 215 | else{ | ||||
| 216 | 28 | 422µs | Mouse::Util::install_subroutines($into, %{$spec->{DEFAULT}}); # spent 422µs making 28 calls to Mouse::Util::install_subroutines, avg 15µs/call | ||
| 217 | } | ||||
| 218 | return; | ||||
| 219 | } | ||||
| 220 | |||||
| 221 | # the entity of general unimport() | ||||
| 222 | # spent 899µs (835+63) within Mouse::Exporter::do_unimport which was called 11 times, avg 82µs/call:
# once (94µs+5µs) by MouseX::Getopt::Meta::Attribute::Trait::BEGIN@34 at line 34 of MouseX/Getopt/Meta/Attribute/Trait.pm
# once (89µs+7µs) by MouseX::Getopt::GLD::BEGIN@73 at line 73 of MouseX/Getopt/GLD.pm
# once (89µs+5µs) by MouseX::Getopt::BEGIN@14 at line 14 of MouseX/Getopt.pm
# once (82µs+9µs) by MouseX::Getopt::Basic::BEGIN@235 at line 235 of MouseX/Getopt/Basic.pm
# once (84µs+5µs) by MouseX::Getopt::Dashes::BEGIN@26 at line 26 of MouseX/Getopt/Dashes.pm
# once (81µs+5µs) by MouseX::Getopt::Meta::Attribute::Trait::NoGetopt::BEGIN@11 at line 11 of MouseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm
# once (79µs+5µs) by MouseX::Getopt::Meta::Attribute::Trait::BEGIN@35 at line 35 of MouseX/Getopt/Meta/Attribute/Trait.pm
# once (74µs+6µs) by MouseX::Getopt::Meta::Attribute::NoGetopt::BEGIN@15 at line 15 of MouseX/Getopt/Meta/Attribute/NoGetopt.pm
# once (70µs+5µs) by MouseX::Getopt::Meta::Attribute::BEGIN@16 at line 16 of MouseX/Getopt/Meta/Attribute.pm
# once (56µs+6µs) by MouseX::Getopt::OptionTypeMap::BEGIN@75 at line 75 of MouseX/Getopt/OptionTypeMap.pm
# once (38µs+5µs) by MouseX::Getopt::OptionTypeMap::BEGIN@76 at line 76 of MouseX/Getopt/OptionTypeMap.pm | ||||
| 223 | 66 | 204µs | my($package, $arg) = @_; | ||
| 224 | |||||
| 225 | my $spec = $SPEC{$package} | ||||
| 226 | || Carp::confess("The package $package does not use Mouse::Exporter"); | ||||
| 227 | |||||
| 228 | 11 | 63µs | my $from = _get_caller_package($arg); # spent 63µs making 11 calls to Mouse::Exporter::_get_caller_package, avg 6µs/call | ||
| 229 | |||||
| 230 | 11 | 28µs | my $stash = do{ | ||
| 231 | 2 | 155µs | 2 | 64µs | # spent 38µs (13+25) within Mouse::Exporter::BEGIN@231 which was called:
# once (13µs+25µs) by Mouse::BEGIN@4 at line 231 # spent 38µs making 1 call to Mouse::Exporter::BEGIN@231
# spent 26µs making 1 call to strict::unimport |
| 232 | \%{$from . '::'} | ||||
| 233 | }; | ||||
| 234 | |||||
| 235 | for my $keyword (@{ $spec->{REMOVABLES} }) { | ||||
| 236 | 348 | 609µs | next if !exists $stash->{$keyword}; | ||
| 237 | my $gv = \$stash->{$keyword}; | ||||
| 238 | if(ref($gv) eq 'GLOB' && *{$gv}{CODE} == $spec->{EXPORTS}{$keyword}){ # make sure it is from us | ||||
| 239 | delete $stash->{$keyword}; | ||||
| 240 | } | ||||
| 241 | } | ||||
| 242 | return; | ||||
| 243 | } | ||||
| 244 | |||||
| 245 | sub _get_caller_package { | ||||
| 246 | 102 | 134µs | my($arg) = @_; | ||
| 247 | |||||
| 248 | # We need one extra level because it's called by import so there's a layer | ||||
| 249 | # of indirection | ||||
| 250 | 48 | 248µs | if(ref $arg){ | ||
| 251 | return defined($arg->{into}) ? $arg->{into} | ||||
| 252 | : defined($arg->{into_level}) ? scalar caller(1 + $arg->{into_level}) | ||||
| 253 | : scalar caller(1); | ||||
| 254 | } | ||||
| 255 | else{ | ||||
| 256 | return scalar caller(1); | ||||
| 257 | } | ||||
| 258 | } | ||||
| 259 | |||||
| 260 | #sub _spec{ %SPEC } | ||||
| 261 | |||||
| 262 | 1 | 5µs | 1; | ||
| 263 | __END__ | ||||
# spent 51µs within Mouse::Exporter::CORE:subst which was called 30 times, avg 2µs/call:
# 30 times (51µs+0s) by Mouse::Exporter::do_import at line 154, avg 2µs/call |