| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/x86_64-linux/Scalar/Util.pm |
| Statements | Executed 14 statements in 1.89ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 14032 | 58 | 31 | 84.7ms | 84.7ms | Scalar::Util::blessed (xsub) |
| 3567 | 14 | 12 | 24.9ms | 24.9ms | Scalar::Util::weaken (xsub) |
| 2947 | 8 | 5 | 15.7ms | 15.7ms | Scalar::Util::reftype (xsub) |
| 505 | 1 | 1 | 2.96ms | 2.96ms | Scalar::Util::isweak (xsub) |
| 184 | 2 | 2 | 846µs | 846µs | Scalar::Util::refaddr (xsub) |
| 1 | 1 | 1 | 80µs | 98µs | Scalar::Util::BEGIN@9 |
| 1 | 1 | 1 | 38µs | 417µs | Scalar::Util::BEGIN@10 |
| 4 | 1 | 1 | 34µs | 34µs | Scalar::Util::set_prototype (xsub) |
| 0 | 0 | 0 | 0s | 0s | Scalar::Util::export_fail |
| 0 | 0 | 0 | 0s | 0s | Scalar::Util::openhandle |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # Scalar::Util.pm | ||||
| 2 | # | ||||
| 3 | # Copyright (c) 1997-2007 Graham Barr <gbarr@pobox.com>. All rights reserved. | ||||
| 4 | # This program is free software; you can redistribute it and/or | ||||
| 5 | # modify it under the same terms as Perl itself. | ||||
| 6 | |||||
| 7 | package Scalar::Util; | ||||
| 8 | |||||
| 9 | 3 | 120µs | 2 | 116µs | # spent 98µs (80+18) within Scalar::Util::BEGIN@9 which was called:
# once (80µs+18µs) by Class::MOP::BEGIN@12 at line 9 # spent 98µs making 1 call to Scalar::Util::BEGIN@9
# spent 18µs making 1 call to strict::import |
| 10 | 3 | 1.22ms | 2 | 797µs | # spent 417µs (38+380) within Scalar::Util::BEGIN@10 which was called:
# once (38µs+380µs) by Class::MOP::BEGIN@12 at line 10 # spent 417µs making 1 call to Scalar::Util::BEGIN@10
# spent 379µs making 1 call to vars::import |
| 11 | 1 | 4µs | require Exporter; | ||
| 12 | 1 | 408µs | require List::Util; # List::Util loads the XS | ||
| 13 | |||||
| 14 | 1 | 29µs | @ISA = qw(Exporter); | ||
| 15 | 1 | 12µs | @EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number set_prototype); | ||
| 16 | 1 | 3µs | $VERSION = "1.21"; | ||
| 17 | 1 | 70µs | $VERSION = eval $VERSION; # spent 9µs executing statements in string eval | ||
| 18 | |||||
| 19 | 1 | 2µs | unless (defined &dualvar) { | ||
| 20 | # Load Pure Perl version if XS not loaded | ||||
| 21 | require Scalar::Util::PP; | ||||
| 22 | Scalar::Util::PP->import; | ||||
| 23 | push @EXPORT_FAIL, qw(weaken isweak dualvar isvstring set_prototype); | ||||
| 24 | } | ||||
| 25 | |||||
| 26 | sub export_fail { | ||||
| 27 | if (grep { /dualvar/ } @EXPORT_FAIL) { # no XS loaded | ||||
| 28 | my $pat = join("|", @EXPORT_FAIL); | ||||
| 29 | if (my ($err) = grep { /^($pat)$/ } @_ ) { | ||||
| 30 | require Carp; | ||||
| 31 | Carp::croak("$err is only available with the XS version of Scalar::Util"); | ||||
| 32 | } | ||||
| 33 | } | ||||
| 34 | |||||
| 35 | if (grep { /^(weaken|isweak)$/ } @_ ) { | ||||
| 36 | require Carp; | ||||
| 37 | Carp::croak("Weak references are not implemented in the version of perl"); | ||||
| 38 | } | ||||
| 39 | |||||
| 40 | if (grep { /^(isvstring)$/ } @_ ) { | ||||
| 41 | require Carp; | ||||
| 42 | Carp::croak("Vstrings are not implemented in the version of perl"); | ||||
| 43 | } | ||||
| 44 | |||||
| 45 | @_; | ||||
| 46 | } | ||||
| 47 | |||||
| 48 | sub openhandle ($) { | ||||
| 49 | my $fh = shift; | ||||
| 50 | my $rt = reftype($fh) || ''; | ||||
| 51 | |||||
| 52 | return defined(fileno($fh)) ? $fh : undef | ||||
| 53 | if $rt eq 'IO'; | ||||
| 54 | |||||
| 55 | if (reftype(\$fh) eq 'GLOB') { # handle openhandle(*DATA) | ||||
| 56 | $fh = \(my $tmp=$fh); | ||||
| 57 | } | ||||
| 58 | elsif ($rt ne 'GLOB') { | ||||
| 59 | return undef; | ||||
| 60 | } | ||||
| 61 | |||||
| 62 | (tied(*$fh) or defined(fileno($fh))) | ||||
| 63 | ? $fh : undef; | ||||
| 64 | } | ||||
| 65 | |||||
| 66 | 1 | 26µs | 1; | ||
| 67 | |||||
| 68 | __END__ | ||||
# spent 84.7ms within Scalar::Util::blessed which was called 14032 times, avg 6µs/call:
# 2175 times (14.6ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 57 of Class/MOP/Mixin/HasMethods.pm, avg 7µs/call
# 1654 times (11.3ms+0s) by Class::MOP::Mixin::HasMethods::get_method at line 117 of Class/MOP/Mixin/HasMethods.pm, avg 7µs/call
# 1438 times (7.43ms+0s) by Class::MOP::class_of at line 61 of Class/MOP.pm, avg 5µs/call
# 1414 times (8.33ms+0s) by Class::MOP::Method::clone at line 133 of Class/MOP/Method.pm, avg 6µs/call
# 1239 times (5.87ms+0s) by Moose::Meta::Attribute::_new or Moose::Meta::Instance::_new or Moose::Meta::Method::Accessor::_new or Moose::Meta::Method::Overridden::_new or Moose::Meta::Method::_new or Moose::Meta::Role::Application::RoleSummation::_new or Moose::Meta::Role::Application::ToClass::_new or Moose::Meta::Role::Application::ToRole::_new or Moose::Meta::Role::Composite::_new or Moose::Meta::Role::Method::Conflicting::_new or Moose::Meta::Role::Method::Required::_new or Moose::Meta::Role::Method::_new or Moose::Meta::Role::_new or Moose::Meta::TypeConstraint::Class::_new or Moose::Meta::TypeConstraint::Enum::_new or Moose::Meta::TypeConstraint::Parameterizable::_new or Moose::Meta::TypeConstraint::Parameterized::_new or Moose::Meta::TypeConstraint::Role::_new or Moose::Meta::TypeConstraint::_new or MooseX::Role::Parameterized::Meta::Parameter::_new at line 3 of generated method (unknown origin), avg 5µs/call
# 1033 times (5.59ms+0s) by Moose::Util::TypeConstraints::find_type_constraint at line 256 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 904 times (5.00ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 6µs/call
# 641 times (3.90ms+0s) by Class::MOP::Class::__ANON__::SERIAL::11::meta or Class::MOP::Class::__ANON__::SERIAL::15::meta or Class::MOP::Class::__ANON__::SERIAL::19::meta or Class::MOP::Class::__ANON__::SERIAL::1::meta or Class::MOP::Class::__ANON__::SERIAL::2::meta or Class::MOP::Class::__ANON__::SERIAL::5::meta or Class::MOP::Class::__ANON__::SERIAL::8::meta or Class::MOP::Mixin::meta or Class::MOP::Object::meta or Markdent::Dialect::Standard::BlockParser::meta or Markdent::Dialect::Standard::SpanParser::meta or Markdent::Event::AutoLink::meta or Markdent::Event::EndBlockquote::meta or Markdent::Event::EndCode::meta or Markdent::Event::EndDocument::meta or Markdent::Event::EndEmphasis::meta or Markdent::Event::EndHTMLTag::meta or Markdent::Event::EndHeader::meta or Markdent::Event::EndLink::meta or Markdent::Event::EndListItem::meta or Markdent::Event::EndOrderedList::meta or Markdent::Event::EndParagraph::meta or Markdent::Event::EndStrong::meta or Markdent::Event::EndUnorderedList::meta or Markdent::Event::HTMLBlock::meta or Markdent::Event::HTMLComment::meta or Markdent::Event::HTMLCommentBlock::meta or Markdent::Event::HTMLEntity::meta or Markdent::Event::HTMLTag::meta or Markdent::Event::HorizontalRule::meta or Markdent::Event::Image::meta or Markdent::Event::Preformatted::meta or Markdent::Event::StartBlockquote::meta or Markdent::Event::StartCode::meta or Markdent::Event::StartDocument::meta or Markdent::Event::StartEmphasis::meta or Markdent::Event::StartHTMLTag::meta or Markdent::Event::StartHeader::meta or Markdent::Event::StartLink::meta or Markdent::Event::StartListItem::meta or Markdent::Event::StartOrderedList::meta or Markdent::Event::StartParagraph::meta or Markdent::Event::StartStrong::meta or Markdent::Event::StartUnorderedList::meta or Markdent::Event::Text::meta or Markdent::Handler::HTMLStream::Document::meta or Markdent::Parser::meta or Moose::Meta::Role::Application::RoleSummation::meta or Moose::Meta::Role::Application::ToClass::meta or Moose::Meta::Role::Application::ToInstance::meta or Moose::Meta::Role::Application::ToRole::meta or Moose::Meta::Role::Application::meta or Moose::Meta::Role::Composite::meta or Moose::Meta::Role::Method::Required::meta or Moose::Meta::Role::meta or Moose::Meta::TypeCoercion::Union::meta or Moose::Meta::TypeCoercion::meta or Moose::Meta::TypeConstraint::Class::meta or Moose::Meta::TypeConstraint::DuckType::meta or Moose::Meta::TypeConstraint::Enum::meta or Moose::Meta::TypeConstraint::Parameterizable::meta or Moose::Meta::TypeConstraint::Parameterized::meta or Moose::Meta::TypeConstraint::Registry::meta or Moose::Meta::TypeConstraint::Role::meta or Moose::Meta::TypeConstraint::Union::meta or Moose::Meta::TypeConstraint::meta or MooseX::Role::Parameterized::Meta::Parameter::meta or MooseX::Role::Parameterized::Meta::Role::Parameterizable::meta or MooseX::Role::Parameterized::Meta::Role::Parameterized::meta or MooseX::Role::Parameterized::Parameters::meta at line 44 of Class/MOP/Method/Meta.pm, avg 6µs/call
# 390 times (2.83ms+0s) by Class::MOP::Class::_construct_instance at line 564 of Class/MOP/Class.pm, avg 7µs/call
# 306 times (1.91ms+0s) by MooseX::Types::TypeDecorator::__type_constraint at line 103 of MooseX/Types/TypeDecorator.pm, avg 6µs/call
# 269 times (2.11ms+0s) by Class::MOP::Method::Accessor::new at line 27 of Class/MOP/Method/Accessor.pm, avg 8µs/call
# 212 times (1.31ms+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 18 of Class/MOP/Mixin/HasAttributes.pm, avg 6µs/call
# 188 times (1.10ms+0s) by Class::MOP::Attribute::attach_to_class at line 238 of Class/MOP/Attribute.pm, avg 6µs/call
# 172 times (1.18ms+0s) by Moose::Meta::TypeConstraint::Class::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/TypeConstraint/Class.pm:38] at line 37 of Moose/Meta/TypeConstraint/Class.pm, avg 7µs/call
# 141 times (940µs+0s) by Moose::Meta::Role::apply at line 436 of Moose/Meta/Role.pm, avg 7µs/call
# 138 times (829µs+0s) by Class::MOP::Instance::BUILDARGS at line 21 of Class/MOP/Instance.pm, avg 6µs/call
# 126 times (716µs+0s) by Class::MOP::Method::Wrapped::wrap at line 74 of Class/MOP/Method/Wrapped.pm, avg 6µs/call
# 116 times (788µs+0s) by Moose::Meta::TypeConstraint::Registry::add_type_constraint at line 47 of Moose/Meta/TypeConstraint/Registry.pm, avg 7µs/call
# 104 times (610µs+0s) by Moose::Util::_apply_all_roles at line 109 of Moose/Util.pm, avg 6µs/call
# 99 times (652µs+0s) by Moose::Util::_apply_all_roles at line 133 of Moose/Util.pm, avg 7µs/call
# 77 times (489µs+0s) by MooseX::Types::TypeDecorator::new at line 77 of MooseX/Types/TypeDecorator.pm, avg 6µs/call
# 75 times (400µs+0s) by MooseX::Types::TypeDecorator::isa at line 121 of MooseX/Types/TypeDecorator.pm, avg 5µs/call
# 73 times (535µs+0s) by Moose::Meta::Class::add_role at line 179 of Moose/Meta/Class.pm, avg 7µs/call
# 73 times (412µs+0s) by Moose::Meta::Class::add_role_application at line 192 of Moose/Meta/Class.pm, avg 6µs/call
# 72 times (389µs+0s) by Moose::Meta::Class::add_attribute at line 484 of Moose/Meta/Class.pm, avg 5µs/call
# 72 times (369µs+0s) by Moose::Meta::Role::Composite::add_method at line 81 of Moose/Meta/Role/Composite.pm, avg 5µs/call
# 68 times (527µs+0s) by Moose::Meta::Role::add_role at line 397 of Moose/Meta/Role.pm, avg 8µs/call
# 62 times (441µs+0s) by Moose::Meta::Attribute::_process_isa_option at line 325 of Moose/Meta/Attribute.pm, avg 7µs/call
# 48 times (240µs+0s) by Moose::Meta::Role::add_attribute at line 239 of Moose/Meta/Role.pm, avg 5µs/call
# 43 times (339µs+0s) by Moose::Meta::Method::Destructor::is_needed at line 58 of Moose/Meta/Method/Destructor.pm, avg 8µs/call
# 42 times (278µs+0s) by Class::MOP::Class::reinitialize at line 53 of Class/MOP/Class.pm, avg 7µs/call
# 42 times (273µs+0s) by Class::MOP::Object::_real_ref_name at line 43 of Class/MOP/Object.pm, avg 6µs/call
# 42 times (265µs+0s) by Class::MOP::Package::reinitialize at line 51 of Class/MOP/Package.pm, avg 6µs/call
# 42 times (251µs+0s) by Moose::Meta::Class::reinitialize at line 135 of Moose/Meta/Class.pm, avg 6µs/call
# 42 times (231µs+0s) by Class::MOP::Class::reinitialize at line 56 of Class/MOP/Class.pm, avg 6µs/call
# 42 times (224µs+0s) by Class::MOP::Package::reinitialize at line 55 of Class/MOP/Package.pm, avg 5µs/call
# 42 times (209µs+0s) by Moose::Util::MetaRole::apply_metaroles at line 30 of Moose/Util/MetaRole.pm, avg 5µs/call
# 42 times (201µs+0s) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::generate_role at line 77 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 5µs/call
# 38 times (212µs+0s) by MooseX::Types::TypeDecorator::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm:26] at line 21 of MooseX/Types/TypeDecorator.pm, avg 6µs/call
# 33 times (191µs+0s) by Class::MOP::Object::meta at line 18 of Class/MOP/Object.pm, avg 6µs/call
# 31 times (229µs+0s) by Class::MOP::Method::Constructor::new at line 21 of Class/MOP/Method/Constructor.pm, avg 7µs/call
# 26 times (148µs+0s) by Moose::Meta::Role::add_required_methods at line 261 of Moose/Meta/Role.pm, avg 6µs/call
# 25 times (138µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 6µs/call
# 24 times (132µs+0s) by Moose::Meta::Role::Attribute::attach_to_role at line 55 of Moose/Meta/Role/Attribute.pm, avg 5µs/call
# 22 times (103µs+0s) by Moose::Meta::Role::Application::RoleSummation::get_method_aliases_for_role at line 38 of Moose/Meta/Role/Application/RoleSummation.pm, avg 5µs/call
# 18 times (100µs+0s) by Class::MOP::Mixin::meta at line 14 of Class/MOP/Mixin.pm, avg 6µs/call
# 9 times (59µs+0s) by Moose::Meta::Attribute::_process_does_option at line 342 of Moose/Meta/Attribute.pm, avg 7µs/call
# 8 times (44µs+0s) by Moose::Meta::Role::combine at line 496 of Moose/Meta/Role.pm, avg 6µs/call
# 8 times (42µs+0s) by Moose::Util::TypeConstraints::subtype at line 345 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 8 times (40µs+0s) by Moose::Meta::Role::Application::RoleSummation::get_exclusions_for_role at line 24 of Moose/Meta/Role/Application/RoleSummation.pm, avg 5µs/call
# 6 times (40µs+0s) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 46 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 7µs/call
# 6 times (28µs+0s) by Moose::Meta::Role::does_role at line 417 of Moose/Meta/Role.pm, avg 5µs/call
# 4 times (24µs+0s) by Moose::Util::MetaRole::_make_new_metaclass at line 108 of Moose/Util/MetaRole.pm, avg 6µs/call
# 4 times (24µs+0s) by MooseX::Types::TypeDecorator::can at line 141 of MooseX/Types/TypeDecorator.pm, avg 6µs/call
# once (11µs+0s) by Moose::Meta::Method::Delegation::new at line 25 of Moose/Meta/Method/Delegation.pm
# once (9µs+0s) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 129 of Moose/Meta/Method/Delegation.pm
# once (6µs+0s) by Class::MOP::Class::_clone_instance at line 819 of Class/MOP/Class.pm
# once (6µs+0s) by Class::MOP::Class::clone_object at line 806 of Class/MOP/Class.pm | |||||
# spent 2.96ms within Scalar::Util::isweak which was called 505 times, avg 6µs/call:
# 505 times (2.96ms+0s) by Class::MOP::metaclass_is_weak at line 54 of Class/MOP.pm, avg 6µs/call | |||||
# spent 846µs within Scalar::Util::refaddr which was called 184 times, avg 5µs/call:
# 106 times (450µs+0s) by Moose::Meta::TypeConstraint::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/TypeConstraint.pm:8] at line 8 of Moose/Meta/TypeConstraint.pm, avg 4µs/call
# 78 times (396µs+0s) by Class::MOP::Method::Inlined::can_be_inlined at line 72 of Class/MOP/Method/Inlined.pm, avg 5µs/call | |||||
# spent 15.7ms within Scalar::Util::reftype which was called 2947 times, avg 5µs/call:
# 1418 times (7.31ms+0s) by Sub::Install::_CODELIKE at line 98 of Sub/Install.pm, avg 5µs/call
# 904 times (4.79ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 5µs/call
# 296 times (1.89ms+0s) by Eval::Closure::_canonicalize_source at line 43 of Eval/Closure.pm, avg 6µs/call
# 296 times (1.49ms+0s) by Eval::Closure::_validate_env at line 67 of Eval/Closure.pm, avg 5µs/call
# 24 times (172µs+0s) by List::MoreUtils::all at line 315 of Moose/Util/TypeConstraints.pm, avg 7µs/call
# 6 times (43µs+0s) by __TYPE__::ArrayRef or __TYPE__::HashRef at line 392 of MooseX/Types.pm, avg 7µs/call
# 2 times (11µs+0s) by List::MoreUtils::any at line 278 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# once (8µs+0s) by Moose::Util::TypeConstraints::subtype at line 303 of Moose/Util/TypeConstraints.pm | |||||
# spent 34µs within Scalar::Util::set_prototype which was called 4 times, avg 8µs/call:
# 4 times (34µs+0s) by Moose::Exporter::_curry_wrapper at line 339 of Moose/Exporter.pm, avg 8µs/call | |||||
# spent 24.9ms within Scalar::Util::weaken which was called 3567 times, avg 7µs/call:
# 2152 times (13.8ms+0s) by Class::MOP::Method::attach_to_class at line 75 of Class/MOP/Method.pm, avg 6µs/call
# 473 times (3.76ms+0s) by Class::MOP::Method::wrap at line 46 of Class/MOP/Method.pm, avg 8µs/call
# 269 times (2.39ms+0s) by Class::MOP::Method::Accessor::new at line 38 of Class/MOP/Method/Accessor.pm, avg 9µs/call
# 188 times (1.40ms+0s) by Class::MOP::Attribute::attach_to_class at line 240 of Class/MOP/Attribute.pm, avg 7µs/call
# 138 times (1.00ms+0s) by Class::MOP::Instance::new at line 45 of Class/MOP/Instance.pm, avg 7µs/call
# 73 times (487µs+0s) by Moose::Meta::Role::Application::ToClass::apply at line 28 of Moose/Meta/Role/Application/ToClass.pm, avg 7µs/call
# 73 times (407µs+0s) by Moose::Meta::Role::Application::ToClass::apply at line 29 of Moose/Meta/Role/Application/ToClass.pm, avg 6µs/call
# 44 times (459µs+0s) by Class::MOP::weaken_metaclass at line 53 of Class/MOP.pm, avg 10µs/call
# 42 times (353µs+0s) by Moose::Meta::Method::Constructor::new at line 41 of Moose/Meta/Method/Constructor.pm, avg 8µs/call
# 39 times (310µs+0s) by Moose::Meta::Method::Destructor::new at line 41 of Moose/Meta/Method/Destructor.pm, avg 8µs/call
# 31 times (246µs+0s) by Class::MOP::Method::Constructor::new at line 33 of Class/MOP/Method/Constructor.pm, avg 8µs/call
# 24 times (148µs+0s) by Moose::Meta::Role::Attribute::attach_to_role at line 59 of Moose/Meta/Role/Attribute.pm, avg 6µs/call
# 20 times (127µs+0s) by Moose::Meta::Class::create_anon_class at line 115 of Moose/Meta/Class.pm, avg 6µs/call
# once (16µs+0s) by Moose::Meta::Method::Delegation::new at line 48 of Moose/Meta/Method/Delegation.pm |