| Filename | C:/tmp64ng/perl/lib/Exporter.pm |
| Statements | Executed 668 statements in 0s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 5 | 1 | 1 | 15.6ms | 15.6ms | Exporter::as_heavy |
| 81 | 2 | 1 | 0s | 0s | Exporter::CORE:match (opcode) |
| 52 | 2 | 1 | 0s | 0s | Exporter::CORE:subst (opcode) |
| 0 | 0 | 0 | 0s | 0s | Exporter::__ANON__[:64] |
| 5 | 1 | 1 | 0s | 15.6ms | Exporter::export |
| 0 | 0 | 0 | 0s | 0s | Exporter::export_fail |
| 0 | 0 | 0 | 0s | 0s | Exporter::export_ok_tags |
| 0 | 0 | 0 | 0s | 0s | Exporter::export_tags |
| 0 | 0 | 0 | 0s | 0s | Exporter::export_to_level |
| 44 | 43 | 22 | 0s | 15.6ms | Exporter::import |
| 0 | 0 | 0 | 0s | 0s | Exporter::require_version |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Exporter; | ||||
| 2 | |||||
| 3 | 1 | 0s | require 5.006; | ||
| 4 | |||||
| 5 | # Be lean. | ||||
| 6 | #use strict; | ||||
| 7 | #no strict 'refs'; | ||||
| 8 | |||||
| 9 | 1 | 0s | our $Debug = 0; | ||
| 10 | 1 | 0s | our $ExportLevel = 0; | ||
| 11 | 1 | 0s | our $Verbose ||= 0; | ||
| 12 | 1 | 0s | our $VERSION = '5.71'; | ||
| 13 | 1 | 0s | our (%Cache); | ||
| 14 | |||||
| 15 | # spent 15.6ms within Exporter::as_heavy which was called 5 times, avg 3.12ms/call:
# 5 times (15.6ms+0s) by Exporter::export at line 25, avg 3.12ms/call | ||||
| 16 | 5 | 0s | require Exporter::Heavy; | ||
| 17 | # Unfortunately, this does not work if the caller is aliased as *name = \&foo | ||||
| 18 | # Thus the need to create a lot of identical subroutines | ||||
| 19 | 5 | 0s | my $c = (caller(1))[3]; | ||
| 20 | 5 | 0s | 5 | 0s | $c =~ s/.*:://; # spent 0s making 5 calls to Exporter::CORE:subst, avg 0s/call |
| 21 | 5 | 0s | \&{"Exporter::Heavy::heavy_$c"}; | ||
| 22 | } | ||||
| 23 | |||||
| 24 | # spent 15.6ms (0s+15.6) within Exporter::export which was called 5 times, avg 3.12ms/call:
# 5 times (0s+15.6ms) by Exporter::import at line 62, avg 3.12ms/call | ||||
| 25 | 5 | 0s | 10 | 15.6ms | goto &{as_heavy()}; # spent 15.6ms making 5 calls to Exporter::as_heavy, avg 3.12ms/call
# spent 0s making 5 calls to Exporter::Heavy::heavy_export, avg 0s/call |
| 26 | } | ||||
| 27 | |||||
| 28 | # spent 15.6ms (0s+15.6) within Exporter::import which was called 44 times, avg 355µs/call:
# 2 times (0s+0s) by main::BEGIN@1.10 or main::BEGIN@1.2 at line 1 of Prec/Makefile.PL, avg 0s/call
# once (0s+15.6ms) by ExtUtils::MM_Any::BEGIN@12 at line 12 of ExtUtils/MM_Any.pm
# once (0s+0s) by Win32::API::Struct::BEGIN@14 at line 14 of Win32/API/Struct.pm
# once (0s+0s) by Win32::API::Struct::BEGIN@15 at line 15 of Win32/API/Struct.pm
# once (0s+0s) by Cwd::BEGIN@171 at line 171 of Cwd.pm
# once (0s+0s) by ExtUtils::MM_Win32::BEGIN@23 at line 23 of ExtUtils/MM_Win32.pm
# once (0s+0s) by ExtUtils::MM_Win32::BEGIN@25 at line 25 of ExtUtils/MM_Win32.pm
# once (0s+0s) by CPAN::Meta::YAML::BEGIN@804 at line 804 of CPAN/Meta/YAML.pm
# once (0s+0s) by CPAN::Meta::YAML::BEGIN@22 at line 22 of CPAN/Meta/YAML.pm
# once (0s+0s) by ExtUtils::Liblist::Kid::BEGIN@18 at line 18 of ExtUtils/Liblist/Kid.pm
# once (0s+0s) by ExtUtils::Liblist::Kid::BEGIN@17 at line 17 of ExtUtils/Liblist/Kid.pm
# once (0s+0s) by ExtUtils::MakeMaker::BEGIN@11 at line 11 of ExtUtils/MakeMaker.pm
# once (0s+0s) by ExtUtils::MakeMaker::BEGIN@220 at line 220 of ExtUtils/MakeMaker.pm
# once (0s+0s) by ExtUtils::MakeMaker::BEGIN@12 at line 12 of ExtUtils/MakeMaker.pm
# once (0s+0s) by Parse::CPAN::Meta::BEGIN@8 at line 8 of Parse/CPAN/Meta.pm
# once (0s+0s) by Parse::CPAN::Meta::BEGIN@7 at line 7 of Parse/CPAN/Meta.pm
# once (0s+0s) by Encode::BEGIN@12 at line 12 of Encode.pm
# once (0s+0s) by Encode::BEGIN@47 at line 47 of Encode.pm
# once (0s+0s) by Win32::API::Type::BEGIN@21 at line 21 of Win32/API/Type.pm
# once (0s+0s) by File::Path::BEGIN@6 at line 6 of File/Path.pm
# once (0s+0s) by Text::ParseWords::BEGIN@8 at line 8 of Text/ParseWords.pm
# once (0s+0s) by ExtUtils::Manifest::BEGIN@6 at line 6 of ExtUtils/Manifest.pm
# once (0s+0s) by ExtUtils::Manifest::BEGIN@7 at line 7 of ExtUtils/Manifest.pm
# once (0s+0s) by ExtUtils::Manifest::BEGIN@9 at line 9 of ExtUtils/Manifest.pm
# once (0s+0s) by ExtUtils::Manifest::BEGIN@5 at line 5 of ExtUtils/Manifest.pm
# once (0s+0s) by Encode::Byte::BEGIN@4 at line 4 of Encode/Byte.pm
# once (0s+0s) by ExtUtils::MM_Unix::BEGIN@1250 at line 1250 of ExtUtils/MM_Unix.pm
# once (0s+0s) by ExtUtils::MM_Unix::BEGIN@7 at line 7 of ExtUtils/MM_Unix.pm
# once (0s+0s) by ExtUtils::MM_Unix::BEGIN@14 at line 14 of ExtUtils/MM_Unix.pm
# once (0s+0s) by ExtUtils::MM_Unix::BEGIN@9 at line 9 of ExtUtils/MM_Unix.pm
# once (0s+0s) by ExtUtils::MM_Unix::BEGIN@2472 at line 2472 of ExtUtils/MM_Unix.pm
# once (0s+0s) by ExtUtils::MM_Any::BEGIN@8 at line 8 of ExtUtils/MM_Any.pm
# once (0s+0s) by ExtUtils::MM_Any::BEGIN@6 at line 6 of ExtUtils/MM_Any.pm
# once (0s+0s) by main::BEGIN@1 at line 1 of Makefile.PL
# once (0s+0s) by Win32::API::BEGIN@63 at line 63 of Win32/API.pm
# once (0s+0s) by Win32::API::BEGIN@36 at line 36 of Win32/API.pm
# once (0s+0s) by Win32::API::BEGIN@62 at line 62 of Win32/API.pm
# once (0s+0s) by DirHandle::BEGIN@32 at line 32 of DirHandle.pm
# once (0s+0s) by DirHandle::BEGIN@31 at line 31 of DirHandle.pm
# once (0s+0s) by CPAN::Meta::BEGIN@55 at line 55 of CPAN/Meta.pm
# once (0s+0s) by CPAN::Meta::Prereqs::BEGIN@16 at line 16 of CPAN/Meta/Prereqs.pm
# once (0s+0s) by CPAN::Meta::Prereqs::BEGIN@15 at line 15 of CPAN/Meta/Prereqs.pm
# once (0s+0s) by Encode::Alias::BEGIN@8 at line 8 of Encode/Alias.pm | ||||
| 29 | 44 | 0s | my $pkg = shift; | ||
| 30 | 44 | 0s | my $callpkg = caller($ExportLevel); | ||
| 31 | |||||
| 32 | 44 | 0s | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||
| 33 | 2 | 0s | *{$callpkg."::import"} = \&import; | ||
| 34 | 2 | 0s | return; | ||
| 35 | } | ||||
| 36 | |||||
| 37 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
| 38 | 42 | 0s | my $exports = \@{"$pkg\::EXPORT"}; | ||
| 39 | # But, avoid creating things if they don't exist, which saves a couple of | ||||
| 40 | # hundred bytes per package processed. | ||||
| 41 | 42 | 0s | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||
| 42 | 42 | 0s | return export $pkg, $callpkg, @_ | ||
| 43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
| 44 | 42 | 0s | my $export_cache = ($Cache{$pkg} ||= {}); | ||
| 45 | 42 | 0s | my $args = @_ or @_ = @$exports; | ||
| 46 | |||||
| 47 | 42 | 0s | if ($args and not %$export_cache) { | ||
| 48 | s/^&//, $export_cache->{$_} = 1 | ||||
| 49 | 6 | 0s | 47 | 0s | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); # spent 0s making 47 calls to Exporter::CORE:subst, avg 0s/call |
| 50 | } | ||||
| 51 | 42 | 0s | my $heavy; | ||
| 52 | # Try very hard not to use {} and hence have to enter scope on the foreach | ||||
| 53 | # We bomb out of the loop with last as soon as heavy is set. | ||||
| 54 | 42 | 0s | if ($args or $fail) { | ||
| 55 | ($heavy = (/\W/ or $args and not exists $export_cache->{$_} | ||||
| 56 | or $fail and @$fail and $_ eq $fail->[0])) and last | ||||
| 57 | 25 | 0s | 46 | 0s | foreach (@_); # spent 0s making 46 calls to Exporter::CORE:match, avg 0s/call |
| 58 | } else { | ||||
| 59 | ($heavy = /\W/) and last | ||||
| 60 | 17 | 0s | 35 | 0s | foreach (@_); # spent 0s making 35 calls to Exporter::CORE:match, avg 0s/call |
| 61 | } | ||||
| 62 | 42 | 0s | 5 | 15.6ms | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 15.6ms making 5 calls to Exporter::export, avg 3.12ms/call |
| 63 | local $SIG{__WARN__} = | ||||
| 64 | 37 | 0s | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||
| 65 | # shortcut for the common case of no type character | ||||
| 66 | 37 | 0s | *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_; | ||
| 67 | } | ||||
| 68 | |||||
| 69 | # Default methods | ||||
| 70 | |||||
| 71 | sub export_fail { | ||||
| 72 | my $self = shift; | ||||
| 73 | @_; | ||||
| 74 | } | ||||
| 75 | |||||
| 76 | # Unfortunately, caller(1)[3] "does not work" if the caller is aliased as | ||||
| 77 | # *name = \&foo. Thus the need to create a lot of identical subroutines | ||||
| 78 | # Otherwise we could have aliased them to export(). | ||||
| 79 | |||||
| 80 | sub export_to_level { | ||||
| 81 | goto &{as_heavy()}; | ||||
| 82 | } | ||||
| 83 | |||||
| 84 | sub export_tags { | ||||
| 85 | goto &{as_heavy()}; | ||||
| 86 | } | ||||
| 87 | |||||
| 88 | sub export_ok_tags { | ||||
| 89 | goto &{as_heavy()}; | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | sub require_version { | ||||
| 93 | goto &{as_heavy()}; | ||||
| 94 | } | ||||
| 95 | |||||
| 96 | 1 | 0s | 1; | ||
| 97 | __END__ | ||||
sub Exporter::CORE:match; # opcode | |||||
sub Exporter::CORE:subst; # opcode |