| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/Exporter.pm |
| Statements | Executed 2729 statements in 32.1ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 158 | 158 | 90 | 27.7ms | 31.8ms | Exporter::import |
| 4 | 2 | 1 | 7.89ms | 8.31ms | Exporter::as_heavy |
| 244 | 1 | 1 | 1.18ms | 1.18ms | Exporter::CORE:match (opcode) |
| 149 | 2 | 1 | 434µs | 434µs | Exporter::CORE:subst (opcode) |
| 3 | 1 | 1 | 68µs | 233µs | Exporter::export |
| 1 | 1 | 1 | 38µs | 8.18ms | Exporter::export_ok_tags |
| 0 | 0 | 0 | 0s | 0s | Exporter::__ANON__[:65] |
| 0 | 0 | 0 | 0s | 0s | Exporter::export_fail |
| 0 | 0 | 0 | 0s | 0s | Exporter::export_tags |
| 0 | 0 | 0 | 0s | 0s | Exporter::export_to_level |
| 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 | 61µs | require 5.006; | ||
| 4 | |||||
| 5 | # Be lean. | ||||
| 6 | #use strict; | ||||
| 7 | #no strict 'refs'; | ||||
| 8 | |||||
| 9 | 1 | 2µs | our $Debug = 0; | ||
| 10 | 1 | 2µs | our $ExportLevel = 0; | ||
| 11 | 1 | 3µs | our $Verbose ||= 0; | ||
| 12 | 1 | 3µs | our $VERSION = '5.63'; | ||
| 13 | 1 | 2µs | our (%Cache); | ||
| 14 | |||||
| 15 | # Carp 1.05+ does this now for us, but we may be running with an old Carp | ||||
| 16 | 1 | 4µs | $Carp::Internal{Exporter}++; | ||
| 17 | |||||
| 18 | sub as_heavy { | ||||
| 19 | 16 | 772µs | require Exporter::Heavy; | ||
| 20 | # Unfortunately, this does not work if the caller is aliased as *name = \&foo | ||||
| 21 | # Thus the need to create a lot of identical subroutines | ||||
| 22 | my $c = (caller(1))[3]; | ||||
| 23 | 4 | 58µs | $c =~ s/.*:://; # spent 58µs making 4 calls to Exporter::CORE:subst, avg 14µs/call | ||
| 24 | \&{"Exporter::Heavy::heavy_$c"}; | ||||
| 25 | } | ||||
| 26 | |||||
| 27 | # spent 233µs (68+165) within Exporter::export which was called 3 times, avg 78µs/call:
# 3 times (68µs+165µs) by Exporter::import at line 63, avg 78µs/call | ||||
| 28 | 3 | 82µs | 6 | 2.46ms | goto &{as_heavy()}; # spent 2.30ms making 3 calls to Exporter::Heavy::heavy_export, avg 765µs/call
# spent 164µs making 3 calls to Exporter::as_heavy, avg 55µs/call |
| 29 | } | ||||
| 30 | |||||
| 31 | # spent 31.8ms (27.7+4.08) within Exporter::import which was called 158 times, avg 201µs/call:
# once (112µs+1.53ms) by List::AllUtils::BEGIN@14 at line 14 of List/AllUtils.pm
# once (204µs+743µs) by Markdent::Dialect::Standard::BlockParser::BEGIN@28 at line 28 of Markdent/Dialect/Standard/BlockParser.pm
# once (598µs+103µs) by Markdent::Regexes::BEGIN@9 at line 9 of Markdent/Regexes.pm
# once (579µs+17µs) by Markdent::Parser::BEGIN@14 at line 14 of Markdent/Parser.pm
# once (510µs+78µs) by Class::MOP::Class::BEGIN@18 at line 18 of Class/MOP/Class.pm
# once (427µs+67µs) by Package::DeprecationManager::BEGIN@11 at line 11 of Package/DeprecationManager.pm
# once (112µs+300µs) by Markdent::Dialect::Standard::SpanParser::BEGIN@28 at line 28 of Markdent/Dialect/Standard/SpanParser.pm
# once (348µs+43µs) by Class::MOP::BEGIN@12 at line 12 of Class/MOP.pm
# once (320µs+27µs) by List::AllUtils::BEGIN@10 at line 12 of List/AllUtils.pm
# once (286µs+17µs) by Moose::Meta::Method::Accessor::BEGIN@7 at line 7 of Moose/Meta/Method/Accessor.pm
# once (260µs+27µs) by Class::MOP::BEGIN@11 at line 11 of Class/MOP.pm
# once (256µs+14µs) by Carp::BEGIN@11 at line 11 of Carp/Heavy.pm
# once (238µs+26µs) by Moose::Util::MetaRole::BEGIN@12 at line 12 of Moose/Util/MetaRole.pm
# once (239µs+15µs) by Moose::Meta::Method::Constructor::BEGIN@8 at line 8 of Moose/Meta/Method/Constructor.pm
# once (227µs+20µs) by MooseX::Params::Validate::BEGIN@7 at line 7 of MooseX/Params/Validate.pm
# once (227µs+16µs) by IO::Handle::BEGIN@264 at line 264 of IO/Handle.pm
# once (221µs+19µs) by namespace::clean::BEGIN@15 at line 15 of namespace/clean.pm
# once (230µs+6µs) by Moose::Meta::Role::Application::ToRole::BEGIN@7 at line 7 of Moose/Meta/Role/Application/ToRole.pm
# once (216µs+18µs) by Markdent::Dialect::Standard::BlockParser::BEGIN@9 at line 9 of Markdent/Dialect/Standard/BlockParser.pm
# once (225µs+9µs) by Moose::Meta::Role::BEGIN@8 at line 8 of Moose/Meta/Role.pm
# once (216µs+14µs) by MooseX::Types::Base::BEGIN@12 at line 12 of MooseX/Types/Base.pm
# once (209µs+11µs) by Class::MOP::BEGIN@14 at line 14 of Class/MOP.pm
# once (207µs+13µs) by HTML::Stream::BEGIN@421 at line 421 of HTML/Stream.pm
# once (202µs+13µs) by IO::Handle::BEGIN@263 at line 263 of IO/Handle.pm
# once (198µs+14µs) by Class::MOP::Mixin::HasMethods::BEGIN@14 at line 14 of Class/MOP/Mixin/HasMethods.pm
# once (199µs+11µs) by Try::Tiny::BEGIN@46 at line 46 of Try/Tiny.pm
# once (197µs+13µs) by Class::MOP::Method::Inlined::BEGIN@7 at line 7 of Class/MOP/Method/Inlined.pm
# once (195µs+13µs) by IO::BEGIN@6 at line 6 of IO.pm
# once (195µs+11µs) by Memoize::BEGIN@27 at line 27 of Memoize.pm
# once (198µs+9µs) by Class::MOP::Method::Constructor::BEGIN@9 at line 9 of Class/MOP/Method/Constructor.pm
# once (193µs+13µs) by Sub::Install::BEGIN@6 at line 6 of Sub/Install.pm
# once (200µs+6µs) by Moose::Meta::Role::BEGIN@9 at line 9 of Moose/Meta/Role.pm
# once (196µs+10µs) by Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@8 at line 8 of Moose/Util/TypeConstraints/OptimizedConstraints.pm
# once (194µs+12µs) by Moose::Meta::Class::BEGIN@12 at line 12 of Moose/Meta/Class.pm
# once (192µs+13µs) by Class::MOP::Class::BEGIN@17 at line 17 of Class/MOP/Class.pm
# once (195µs+10µs) by Moose::Meta::Attribute::BEGIN@8 at line 8 of Moose/Meta/Attribute.pm
# once (193µs+11µs) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm
# once (190µs+13µs) by Eval::Closure::BEGIN@13 at line 13 of Eval/Closure.pm
# once (196µs+7µs) by Moose::Meta::Method::Accessor::Native::Writer::BEGIN@6 at line 6 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (187µs+9µs) by Class::MOP::Package::BEGIN@7 at line 7 of Class/MOP/Package.pm
# once (186µs+10µs) by Moose::Meta::Attribute::Native::Trait::BEGIN@5 at line 5 of Moose/Meta/Attribute/Native/Trait.pm
# once (186µs+10µs) by Class::MOP::Instance::BEGIN@7 at line 7 of Class/MOP/Instance.pm
# once (187µs+8µs) by Class::MOP::Method::Accessor::BEGIN@8 at line 8 of Class/MOP/Method/Accessor.pm
# once (183µs+11µs) by Moose::Meta::TypeConstraint::BEGIN@13 at line 13 of Moose/Meta/TypeConstraint.pm
# once (184µs+10µs) by Moose::Util::TypeConstraints::BEGIN@5 at line 5 of Moose/Util/TypeConstraints.pm
# once (186µs+6µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@7 at line 7 of Moose/Meta/Role/Application/RoleSummation.pm
# once (182µs+10µs) by Moose::Meta::Role::Application::ToClass::BEGIN@8 at line 8 of Moose/Meta/Role/Application/ToClass.pm
# once (180µs+10µs) by Moose::Meta::Method::Destructor::BEGIN@8 at line 8 of Moose/Meta/Method/Destructor.pm
# once (183µs+7µs) by Class::MOP::Class::Immutable::Trait::BEGIN@9 at line 9 of Class/MOP/Class/Immutable/Trait.pm
# once (179µs+11µs) by MooseX::Types::CheckedUtilExports::BEGIN@16 at line 16 of MooseX/Types/CheckedUtilExports.pm
# once (177µs+12µs) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm
# once (176µs+11µs) by Moose::Exporter::BEGIN@12 at line 12 of Moose/Exporter.pm
# once (174µs+10µs) by Class::MOP::Attribute::BEGIN@11 at line 11 of Class/MOP/Attribute.pm
# once (174µs+10µs) by Moose::Meta::Method::Constructor::BEGIN@9 at line 9 of Moose/Meta/Method/Constructor.pm
# once (175µs+7µs) by Moose::Meta::Class::Immutable::Trait::BEGIN@7 at line 7 of Moose/Meta/Class/Immutable/Trait.pm
# once (174µs+8µs) by Moose::Meta::Role::Attribute::BEGIN@6 at line 6 of Moose/Meta/Role/Attribute.pm
# once (174µs+7µs) by Moose::Meta::Object::Trait::BEGIN@4 at line 4 of Moose/Meta/Object/Trait.pm
# once (174µs+8µs) by Moose::Meta::Class::BEGIN@9 at line 9 of Moose/Meta/Class.pm
# once (172µs+9µs) by Class::MOP::Method::Accessor::BEGIN@9 at line 9 of Class/MOP/Method/Accessor.pm
# once (172µs+9µs) by Class::MOP::Class::BEGIN@14 at line 14 of Class/MOP/Class.pm
# once (173µs+7µs) by MooseX::Types::CheckedUtilExports::BEGIN@15 at line 15 of MooseX/Types/CheckedUtilExports.pm
# once (170µs+9µs) by Class::MOP::Method::BEGIN@8 at line 8 of Class/MOP/Method.pm
# once (171µs+7µs) by Moose::Util::BEGIN@7 at line 7 of Moose/Util.pm
# once (170µs+8µs) by Moose::Meta::TypeConstraint::Role::BEGIN@7 at line 7 of Moose/Meta/TypeConstraint/Role.pm
# once (172µs+7µs) by Moose::Meta::Method::Delegation::BEGIN@8 at line 8 of Moose/Meta/Method/Delegation.pm
# once (170µs+7µs) by Moose::Meta::Method::Accessor::Native::BEGIN@7 at line 7 of Moose/Meta/Method/Accessor/Native.pm
# once (169µs+8µs) by Class::MOP::Method::Constructor::BEGIN@7 at line 7 of Class/MOP/Method/Constructor.pm
# once (167µs+9µs) by Moose::Meta::Attribute::BEGIN@10 at line 10 of Moose/Meta/Attribute.pm
# once (166µs+9µs) by Moose::Meta::Method::Destructor::BEGIN@9 at line 9 of Moose/Meta/Method/Destructor.pm
# once (166µs+7µs) by Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7 at line 7 of Moose/Meta/Method/Accessor/Native/Hash/set.pm
# once (166µs+7µs) by Variable::Magic::BEGIN@8 at line 8 of Variable/Magic.pm
# once (166µs+7µs) by Class::MOP::Attribute::BEGIN@10 at line 10 of Class/MOP/Attribute.pm
# once (165µs+8µs) by Moose::Role::BEGIN@5 at line 5 of Moose/Role.pm
# once (163µs+9µs) by Class::MOP::Method::Meta::BEGIN@7 at line 7 of Class/MOP/Method/Meta.pm
# once (163µs+7µs) by Class::MOP::Method::BEGIN@7 at line 7 of Class/MOP/Method.pm
# once (161µs+9µs) by metaclass::BEGIN@9 at line 9 of metaclass.pm
# once (164µs+5µs) by namespace::clean::BEGIN@14 at line 14 of namespace/clean.pm
# once (160µs+8µs) by Eval::Closure::BEGIN@15 at line 15 of Eval/Closure.pm
# once (159µs+9µs) by Eval::Closure::BEGIN@17 at line 17 of Eval/Closure.pm
# once (161µs+7µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@8 at line 8 of Moose/Meta/TypeConstraint/Registry.pm
# once (161µs+7µs) by Moose::Util::TypeConstraints::BEGIN@6 at line 6 of Moose/Util/TypeConstraints.pm
# once (159µs+7µs) by Moose::Meta::Method::Accessor::Native::Hash::get::BEGIN@6 at line 6 of Moose/Meta/Method/Accessor/Native/Hash/get.pm
# once (157µs+8µs) by Moose::Meta::Method::Accessor::Native::Array::BEGIN@8 at line 8 of Moose/Meta/Method/Accessor/Native/Array.pm
# once (157µs+8µs) by Moose::Exporter::BEGIN@14 at line 14 of Moose/Exporter.pm
# once (156µs+7µs) by Moose::Meta::TypeConstraint::Union::BEGIN@10 at line 10 of Moose/Meta/TypeConstraint/Union.pm
# once (157µs+6µs) by Moose::Meta::Role::Application::ToInstance::BEGIN@7 at line 7 of Moose/Meta/Role/Application/ToInstance.pm
# once (157µs+7µs) by Moose::Exporter::BEGIN@16 at line 16 of Moose/Exporter.pm
# once (155µs+8µs) by Class::MOP::Attribute::BEGIN@9 at line 9 of Class/MOP/Attribute.pm
# once (156µs+7µs) by Markdent::Dialect::Standard::SpanParser::BEGIN@11 at line 11 of Markdent/Dialect/Standard/SpanParser.pm
# once (155µs+8µs) by MooseX::Role::Parameterized::BEGIN@5 at line 5 of MooseX/Role/Parameterized.pm
# once (155µs+8µs) by MooseX::Types::BEGIN@13 at line 13 of MooseX/Types.pm
# once (155µs+7µs) by Class::MOP::Package::BEGIN@80 at line 80 of Class/MOP/Deprecated.pm
# once (155µs+8µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 12 of Class/MOP/Mixin/HasMethods.pm
# once (157µs+6µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 at line 7 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (156µs+7µs) by Class::MOP::Class::Immutable::Trait::BEGIN@8 at line 8 of Class/MOP/Class/Immutable/Trait.pm
# once (155µs+7µs) by Class::MOP::Class::BEGIN@13 at line 13 of Class/MOP/Class.pm
# once (155µs+7µs) by Markdent::Role::EventsAsMethods::BEGIN@9 at line 9 of Markdent/Role/EventsAsMethods.pm
# once (154µs+8µs) by Moose::Meta::Method::Delegation::BEGIN@7 at line 7 of Moose/Meta/Method/Delegation.pm
# once (155µs+7µs) by Moose::Meta::Method::Accessor::Native::BEGIN@6 at line 6 of Moose/Meta/Method/Accessor/Native.pm
# once (156µs+6µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@7 at line 7 of Moose/Meta/TypeConstraint/DuckType.pm
# once (154µs+8µs) by MooseX::Params::Validate::BEGIN@6 at line 6 of MooseX/Params/Validate.pm
# once (155µs+6µs) by Moose::Meta::Role::Composite::BEGIN@7 at line 7 of Moose/Meta/Role/Composite.pm
# once (154µs+7µs) by Package::DeprecationManager::BEGIN@9 at line 9 of Package/DeprecationManager.pm
# once (154µs+7µs) by MooseX::Params::Validate::BEGIN@8 at line 8 of MooseX/Params/Validate.pm
# once (153µs+8µs) by namespace::autoclean::BEGIN@15 at line 15 of namespace/autoclean.pm
# once (154µs+6µs) by Markdent::Role::BalancedEvent::BEGIN@9 at line 9 of Markdent/Role/BalancedEvent.pm
# once (152µs+7µs) by Class::MOP::Method::Accessor::BEGIN@7 at line 7 of Class/MOP/Method/Accessor.pm
# once (154µs+6µs) by Moose::Meta::TypeCoercion::Union::BEGIN@8 at line 8 of Moose/Meta/TypeCoercion/Union.pm
# once (152µs+8µs) by Class::MOP::Mixin::HasAttributes::BEGIN@10 at line 10 of Class/MOP/Mixin/HasAttributes.pm
# once (153µs+6µs) by Moose::Meta::TypeConstraint::Class::BEGIN@7 at line 7 of Moose/Meta/TypeConstraint/Class.pm
# once (153µs+6µs) by Class::MOP::Mixin::AttributeCore::BEGIN@10 at line 10 of Class/MOP/Mixin/AttributeCore.pm
# once (151µs+7µs) by Class::MOP::Method::Constructor::BEGIN@8 at line 8 of Class/MOP/Method/Constructor.pm
# once (151µs+8µs) by Moose::BEGIN@11 at line 11 of Moose.pm
# once (151µs+7µs) by Class::MOP::Method::Wrapped::BEGIN@7 at line 7 of Class/MOP/Method/Wrapped.pm
# once (152µs+6µs) by MooseX::Types::TypeDecorator::BEGIN@11 at line 11 of MooseX/Types/TypeDecorator.pm
# once (150µs+8µs) by metaclass::BEGIN@7 at line 7 of metaclass.pm
# once (151µs+6µs) by Moose::Util::BEGIN@9 at line 9 of Moose/Util.pm
# once (149µs+7µs) by MooseX::Types::Util::BEGIN@12 at line 12 of MooseX/Types/Util.pm
# once (150µs+6µs) by MooseX::Types::BEGIN@17 at line 17 of MooseX/Types.pm
# once (149µs+7µs) by Class::MOP::Mixin::BEGIN@10 at line 10 of Class/MOP/Mixin.pm
# once (148µs+7µs) by Moose::Meta::Role::Attribute::BEGIN@8 at line 8 of Moose/Meta/Role/Attribute.pm
# once (146µs+7µs) by Moose::Meta::Class::BEGIN@13 at line 13 of Moose/Meta/Class.pm
# once (146µs+7µs) by Class::MOP::Module::BEGIN@7 at line 7 of Class/MOP/Module.pm
# once (148µs+4µs) by Class::MOP::Object::BEGIN@8 at line 8 of Class/MOP/Object.pm
# once (146µs+6µs) by Class::MOP::Method::Generated::BEGIN@7 at line 7 of Class/MOP/Method/Generated.pm
# once (145µs+6µs) by Class::MOP::Method::Inlined::BEGIN@6 at line 6 of Class/MOP/Method/Inlined.pm
# once (146µs+4µs) by Moose::Util::MetaRole::BEGIN@11 at line 11 of Moose/Util/MetaRole.pm
# once (143µs+7µs) by Moose::Util::BEGIN@11 at line 11 of Moose/Util.pm
# once (143µs+6µs) by Class::MOP::Object::BEGIN@7 at line 7 of Class/MOP/Object.pm
# once (149µs+0s) by Markdent::Role::HTMLStream::BEGIN@9 at line 9 of Markdent/Role/HTMLStream.pm
# once (141µs+6µs) by Moose::Util::MetaRole::BEGIN@5 at line 5 of Moose/Util/MetaRole.pm
# once (140µs+4µs) by MooseX::Types::BEGIN@18 at line 18 of MooseX/Types.pm
# once (140µs+4µs) by Class::MOP::Module::BEGIN@8 at line 8 of Class/MOP/Module.pm
# once (135µs+5µs) by Moose::Role::BEGIN@6 at line 6 of Moose/Role.pm
# once (133µs+4µs) by Eval::Closure::BEGIN@16 at line 16 of Eval/Closure.pm
# once (134µs+0s) by Devel::Caller::BEGIN@4 at line 4 of Devel/Caller.pm
# once (128µs+5µs) by Moose::Meta::TypeConstraint::BEGIN@14 at line 14 of Moose/Meta/TypeConstraint.pm
# once (127µs+4µs) by Class::MOP::Mixin::HasMethods::BEGIN@13 at line 13 of Class/MOP/Mixin/HasMethods.pm
# once (127µs+4µs) by Moose::Meta::Role::Attribute::BEGIN@7 at line 7 of Moose/Meta/Role/Attribute.pm
# once (127µs+4µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@8 at line 8 of Moose/Meta/TypeConstraint/DuckType.pm
# once (126µs+4µs) by Moose::Meta::Class::BEGIN@11 at line 11 of Moose/Meta/Class.pm
# once (125µs+4µs) by Class::MOP::Mixin::HasAttributes::BEGIN@11 at line 11 of Class/MOP/Mixin/HasAttributes.pm
# once (125µs+4µs) by Moose::Meta::Attribute::BEGIN@9 at line 9 of Moose/Meta/Attribute.pm
# once (125µs+4µs) by Class::MOP::Class::BEGIN@15 at line 15 of Class/MOP/Class.pm
# once (124µs+4µs) by Class::MOP::Method::Wrapped::BEGIN@8 at line 8 of Class/MOP/Method/Wrapped.pm
# once (124µs+4µs) by Class::MOP::Package::BEGIN@8 at line 8 of Class/MOP/Package.pm
# once (124µs+4µs) by Package::DeprecationManager::BEGIN@10 at line 10 of Package/DeprecationManager.pm
# once (124µs+4µs) by metaclass::BEGIN@8 at line 8 of metaclass.pm
# once (123µs+4µs) by Class::MOP::Method::Meta::BEGIN@8 at line 8 of Class/MOP/Method/Meta.pm
# once (122µs+4µs) by Moose::Util::BEGIN@10 at line 10 of Moose/Util.pm
# once (122µs+4µs) by MooseX::Role::Parameterized::BEGIN@6 at line 6 of MooseX/Role/Parameterized.pm
# once (122µs+4µs) by Moose::BEGIN@12 at line 12 of Moose.pm
# once (118µs+0s) by Markdent::Types::Internal::BEGIN@9 at line 9 of Markdent/Types/Internal.pm
# once (112µs+0s) by B::Hooks::EndOfScope::BEGIN@14 at line 14 of B/Hooks/EndOfScope.pm
# once (105µs+0s) by Params::Validate::BEGIN@6 at line 6 of Params/Validate.pm
# once (98µs+0s) by Sub::Identify::BEGIN@4 at line 4 of Sub/Identify.pm
# once (97µs+0s) by Memoize::BEGIN@28 at line 28 of Memoize.pm
# once (83µs+0s) by HTML::Stream::BEGIN@422 at line 422 of HTML/Stream.pm | ||||
| 32 | 2701 | 31.2ms | my $pkg = shift; | ||
| 33 | my $callpkg = caller($ExportLevel); | ||||
| 34 | |||||
| 35 | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||||
| 36 | *{$callpkg."::import"} = \&import; | ||||
| 37 | return; | ||||
| 38 | } | ||||
| 39 | |||||
| 40 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
| 41 | my($exports, $fail) = (\@{"$pkg\::EXPORT"}, \@{"$pkg\::EXPORT_FAIL"}); | ||||
| 42 | return export $pkg, $callpkg, @_ | ||||
| 43 | if $Verbose or $Debug or @$fail > 1; | ||||
| 44 | my $export_cache = ($Cache{$pkg} ||= {}); | ||||
| 45 | my $args = @_ or @_ = @$exports; | ||||
| 46 | |||||
| 47 | local $_; | ||||
| 48 | if ($args and not %$export_cache) { | ||||
| 49 | s/^&//, $export_cache->{$_} = 1 | ||||
| 50 | 145 | 376µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); # spent 376µs making 145 calls to Exporter::CORE:subst, avg 3µs/call | ||
| 51 | } | ||||
| 52 | my $heavy; | ||||
| 53 | # Try very hard not to use {} and hence have to enter scope on the foreach | ||||
| 54 | # We bomb out of the loop with last as soon as heavy is set. | ||||
| 55 | if ($args or $fail) { | ||||
| 56 | ($heavy = (/\W/ or $args and not exists $export_cache->{$_} | ||||
| 57 | or @$fail and $_ eq $fail->[0])) and last | ||||
| 58 | 244 | 1.18ms | foreach (@_); # spent 1.18ms making 244 calls to Exporter::CORE:match, avg 5µs/call | ||
| 59 | } else { | ||||
| 60 | ($heavy = /\W/) and last | ||||
| 61 | foreach (@_); | ||||
| 62 | } | ||||
| 63 | 3 | 233µs | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 233µs making 3 calls to Exporter::export, avg 78µs/call | ||
| 64 | local $SIG{__WARN__} = | ||||
| 65 | sub {require Carp; &Carp::carp}; | ||||
| 66 | # shortcut for the common case of no type character | ||||
| 67 | *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_; | ||||
| 68 | } | ||||
| 69 | |||||
| 70 | # Default methods | ||||
| 71 | |||||
| 72 | sub export_fail { | ||||
| 73 | my $self = shift; | ||||
| 74 | @_; | ||||
| 75 | } | ||||
| 76 | |||||
| 77 | # Unfortunately, caller(1)[3] "does not work" if the caller is aliased as | ||||
| 78 | # *name = \&foo. Thus the need to create a lot of identical subroutines | ||||
| 79 | # Otherwise we could have aliased them to export(). | ||||
| 80 | |||||
| 81 | sub export_to_level { | ||||
| 82 | goto &{as_heavy()}; | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | sub export_tags { | ||||
| 86 | goto &{as_heavy()}; | ||||
| 87 | } | ||||
| 88 | |||||
| 89 | # spent 8.18ms (38µs+8.14) within Exporter::export_ok_tags which was called:
# once (38µs+8.14ms) by Markdent::Role::HTMLStream::BEGIN@9 at line 431 of HTML/Stream.pm | ||||
| 90 | 1 | 42µs | 2 | 8.25ms | goto &{as_heavy()}; # spent 8.14ms making 1 call to Exporter::as_heavy
# spent 109µs making 1 call to Exporter::Heavy::heavy_export_ok_tags |
| 91 | } | ||||
| 92 | |||||
| 93 | sub require_version { | ||||
| 94 | goto &{as_heavy()}; | ||||
| 95 | } | ||||
| 96 | |||||
| 97 | 1 | 17µs | 1; | ||
| 98 | __END__ | ||||
# spent 1.18ms within Exporter::CORE:match which was called 244 times, avg 5µs/call:
# 244 times (1.18ms+0s) by Exporter::import at line 58, avg 5µs/call | |||||
sub Exporter::CORE:subst; # opcode |