| 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 4.50ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 6976 | 41 | 27 | 42.1ms | 42.1ms | Scalar::Util::blessed (xsub) |
| 2265 | 14 | 11 | 16.4ms | 16.4ms | Scalar::Util::weaken (xsub) |
| 2083 | 7 | 4 | 11.5ms | 11.5ms | Scalar::Util::reftype (xsub) |
| 1 | 1 | 1 | 1.60ms | 3.49ms | Scalar::Util::BEGIN@10 |
| 193 | 1 | 1 | 1.20ms | 1.20ms | Scalar::Util::isweak (xsub) |
| 224 | 3 | 2 | 988µs | 988µs | Scalar::Util::refaddr (xsub) |
| 1 | 1 | 1 | 82µs | 101µs | Scalar::Util::BEGIN@9 |
| 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 | 124µs | 2 | 121µs | # spent 101µs (82+20) within Scalar::Util::BEGIN@9 which was called:
# once (82µs+20µs) by Moose::BEGIN@11 at line 9 # spent 101µs making 1 call to Scalar::Util::BEGIN@9
# spent 20µs making 1 call to strict::import |
| 10 | 3 | 1.53ms | 2 | 3.84ms | # spent 3.49ms (1.60+1.89) within Scalar::Util::BEGIN@10 which was called:
# once (1.60ms+1.89ms) by Moose::BEGIN@11 at line 10 # spent 3.49ms making 1 call to Scalar::Util::BEGIN@10
# spent 350µs making 1 call to vars::import |
| 11 | 1 | 2.32ms | require Exporter; | ||
| 12 | 1 | 381µs | require List::Util; # List::Util loads the XS | ||
| 13 | |||||
| 14 | 1 | 29µs | @ISA = qw(Exporter); | ||
| 15 | 1 | 13µ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 | 71µs | $VERSION = eval $VERSION; # spent 9µs executing statements in string eval | ||
| 18 | |||||
| 19 | 1 | 3µ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 | 28µs | 1; | ||
| 67 | |||||
| 68 | __END__ | ||||
# spent 42.1ms within Scalar::Util::blessed which was called 6976 times, avg 6µs/call:
# 1051 times (7.35ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 57 of Class/MOP/Mixin/HasMethods.pm, avg 7µs/call
# 893 times (4.30ms+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::Parameterizable::_new or Moose::Meta::TypeConstraint::Parameterized::_new or Moose::Meta::TypeConstraint::Role::_new or Moose::Meta::TypeConstraint::Union::_new or Moose::Meta::TypeConstraint::_new at line 3 of generated method (unknown origin), avg 5µs/call
# 685 times (4.52ms+0s) by Class::MOP::Mixin::HasMethods::get_method at line 117 of Class/MOP/Mixin/HasMethods.pm, avg 7µs/call
# 519 times (2.89ms+0s) by Class::MOP::class_of at line 61 of Class/MOP.pm, avg 6µs/call
# 449 times (2.73ms+0s) by 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::Mixin::meta or Class::MOP::Object::meta or Data::Stream::Bulk::Cat::meta or Data::Stream::Bulk::Filter::meta or Data::Stream::Bulk::Nil::meta or Data::Visitor::meta or KiokuDB::Collapser::Buffer::meta or KiokuDB::Collapser::meta or KiokuDB::Entry::Skip::meta or KiokuDB::Entry::meta or KiokuDB::Error::MissingObjects::meta or KiokuDB::Error::UnknownObjects::meta or KiokuDB::Linker::meta or KiokuDB::LiveObjects::Scope::meta or KiokuDB::LiveObjects::TXNScope::meta or KiokuDB::LiveObjects::meta or KiokuDB::Reference::meta or KiokuDB::Stream::Objects::meta or KiokuDB::Thunk::meta or KiokuDB::TypeMap::Entry::Alias::meta or KiokuDB::TypeMap::Entry::Compiled::meta or KiokuDB::TypeMap::Entry::MOP::meta or KiokuDB::TypeMap::Resolver::meta or KiokuDB::TypeMap::Shadow::meta or KiokuDB::TypeMap::meta or KiokuDB::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 at line 44 of Class/MOP/Method/Meta.pm, avg 6µs/call
# 428 times (2.33ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 5µs/call
# 407 times (2.05ms+0s) by Moose::Util::TypeConstraints::find_type_constraint at line 256 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 387 times (2.14ms+0s) by Class::MOP::Method::clone at line 133 of Class/MOP/Method.pm, avg 6µs/call
# 366 times (2.90ms+0s) by Class::MOP::Method::Accessor::new at line 27 of Class/MOP/Method/Accessor.pm, avg 8µs/call
# 254 times (1.60ms+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 18 of Class/MOP/Mixin/HasAttributes.pm, avg 6µs/call
# 239 times (1.35ms+0s) by Class::MOP::Attribute::attach_to_class at line 238 of Class/MOP/Attribute.pm, avg 6µs/call
# 173 times (1.09ms+0s) by Class::MOP::Instance::BUILDARGS at line 21 of Class/MOP/Instance.pm, avg 6µs/call
# 138 times (992µs+0s) by Class::MOP::Class::_construct_instance at line 564 of Class/MOP/Class.pm, avg 7µs/call
# 123 times (653µs+0s) by Moose::Meta::Class::add_attribute at line 484 of Moose/Meta/Class.pm, avg 5µs/call
# 100 times (552µs+0s) by Moose::Meta::Attribute::_process_isa_option at line 325 of Moose/Meta/Attribute.pm, avg 6µs/call
# 98 times (664µs+0s) by Moose::Meta::TypeConstraint::Registry::add_type_constraint at line 47 of Moose/Meta/TypeConstraint/Registry.pm, avg 7µs/call
# 69 times (358µs+0s) by Moose::Meta::Role::add_required_methods at line 261 of Moose/Meta/Role.pm, avg 5µs/call
# 66 times (361µs+0s) by Class::MOP::Method::Wrapped::wrap at line 74 of Class/MOP/Method/Wrapped.pm, avg 5µs/call
# 49 times (256µs+0s) by Moose::Meta::Role::Composite::add_method at line 81 of Moose/Meta/Role/Composite.pm, avg 5µs/call
# 45 times (265µs+0s) by Moose::Util::_apply_all_roles at line 109 of Moose/Util.pm, avg 6µs/call
# 43 times (240µs+0s) by Moose::Meta::Role::Application::RoleSummation::get_method_aliases_for_role at line 38 of Moose/Meta/Role/Application/RoleSummation.pm, avg 6µs/call
# 39 times (250µs+0s) by Moose::Util::_apply_all_roles at line 133 of Moose/Util.pm, avg 6µs/call
# 39 times (223µs+0s) by Moose::Meta::Role::apply at line 436 of Moose/Meta/Role.pm, avg 6µs/call
# 33 times (180µs+0s) by Class::MOP::Object::meta at line 18 of Class/MOP/Object.pm, avg 5µs/call
# 31 times (273µs+0s) by Class::MOP::Method::Constructor::new at line 21 of Class/MOP/Method/Constructor.pm, avg 9µs/call
# 30 times (154µs+0s) by Moose::Meta::Role::add_attribute at line 239 of Moose/Meta/Role.pm, avg 5µs/call
# 24 times (180µs+0s) by Moose::Meta::Method::Destructor::is_needed at line 58 of Moose/Meta/Method/Destructor.pm, avg 8µs/call
# 23 times (167µs+0s) by Moose::Meta::Method::Delegation::new at line 25 of Moose/Meta/Method/Delegation.pm, avg 7µs/call
# 23 times (108µs+0s) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 129 of Moose/Meta/Method/Delegation.pm, avg 5µs/call
# 21 times (158µs+0s) by Moose::Meta::Class::add_role at line 179 of Moose/Meta/Class.pm, avg 8µs/call
# 21 times (114µs+0s) by Moose::Meta::Class::add_role_application at line 192 of Moose/Meta/Class.pm, avg 5µs/call
# 18 times (177µs+0s) by Class::MOP::Mixin::meta at line 14 of Class/MOP/Mixin.pm, avg 10µs/call
# 18 times (134µs+0s) by Moose::Meta::Role::add_role at line 397 of Moose/Meta/Role.pm, avg 7µs/call
# 17 times (93µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 15 times (89µs+0s) by Moose::Meta::Role::Attribute::attach_to_role at line 55 of Moose/Meta/Role/Attribute.pm, avg 6µs/call
# 11 times (57µs+0s) by Moose::Meta::Attribute::_process_does_option at line 342 of Moose/Meta/Attribute.pm, avg 5µs/call
# 10 times (66µs+0s) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 46 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 7µs/call
# 9 times (51µs+0s) by Moose::Meta::Role::combine at line 496 of Moose/Meta/Role.pm, avg 6µs/call
# 9 times (43µ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
# 2 times (15µs+0s) by Moose::Meta::Attribute::_weaken_value at line 695 of Moose/Meta/Attribute.pm, avg 8µs/call
# once (7µs+0s) by Moose::Object::new at line 22 of Moose/Object.pm | |||||
# spent 1.20ms within Scalar::Util::isweak which was called 193 times, avg 6µs/call:
# 193 times (1.20ms+0s) by Class::MOP::metaclass_is_weak at line 54 of Class/MOP.pm, avg 6µs/call | |||||
# spent 988µs within Scalar::Util::refaddr which was called 224 times, avg 4µs/call:
# 174 times (727µ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
# 48 times (252µs+0s) by Class::MOP::Method::Inlined::can_be_inlined at line 72 of Class/MOP/Method/Inlined.pm, avg 5µs/call
# 2 times (9µs+0s) by Class::MOP::Method::Inlined::can_be_inlined at line 77 of Class/MOP/Method/Inlined.pm, avg 5µs/call | |||||
# spent 11.5ms within Scalar::Util::reftype which was called 2083 times, avg 6µs/call:
# 914 times (4.77ms+0s) by Sub::Install::_CODELIKE at line 98 of Sub/Install.pm, avg 5µs/call
# 428 times (2.29ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 5µs/call
# 361 times (2.65ms+0s) by Eval::Closure::_canonicalize_source at line 43 of Eval/Closure.pm, avg 7µs/call
# 361 times (1.66ms+0s) by Eval::Closure::_validate_env at line 67 of Eval/Closure.pm, avg 5µs/call
# 16 times (92µs+0s) by List::MoreUtils::all at line 315 of Moose/Util/TypeConstraints.pm, avg 6µs/call
# 2 times (11µs+0s) by List::MoreUtils::any at line 278 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# once (6µs+0s) by Moose::Util::TypeConstraints::subtype at line 303 of Moose/Util/TypeConstraints.pm | |||||
# spent 16.4ms within Scalar::Util::weaken which was called 2265 times, avg 7µs/call:
# 1028 times (6.56ms+0s) by Class::MOP::Method::attach_to_class at line 75 of Class/MOP/Method.pm, avg 6µs/call
# 366 times (3.26ms+0s) by Class::MOP::Method::Accessor::new at line 38 of Class/MOP/Method/Accessor.pm, avg 9µs/call
# 290 times (2.37ms+0s) by Class::MOP::Method::wrap at line 46 of Class/MOP/Method.pm, avg 8µs/call
# 239 times (1.78ms+0s) by Class::MOP::Attribute::attach_to_class at line 240 of Class/MOP/Attribute.pm, avg 7µs/call
# 173 times (1.28ms+0s) by Class::MOP::Instance::new at line 45 of Class/MOP/Instance.pm, avg 7µs/call
# 31 times (227µs+0s) by Class::MOP::Method::Constructor::new at line 33 of Class/MOP/Method/Constructor.pm, avg 7µs/call
# 24 times (209µs+0s) by Moose::Meta::Method::Constructor::new at line 41 of Moose/Meta/Method/Constructor.pm, avg 9µs/call
# 24 times (186µs+0s) by Moose::Meta::Method::Destructor::new at line 41 of Moose/Meta/Method/Destructor.pm, avg 8µs/call
# 23 times (150µs+0s) by Moose::Meta::Method::Delegation::new at line 48 of Moose/Meta/Method/Delegation.pm, avg 7µs/call
# 21 times (142µs+0s) by Moose::Meta::Role::Application::ToClass::apply at line 28 of Moose/Meta/Role/Application/ToClass.pm, avg 7µs/call
# 21 times (107µs+0s) by Moose::Meta::Role::Application::ToClass::apply at line 29 of Moose/Meta/Role/Application/ToClass.pm, avg 5µs/call
# 15 times (100µs+0s) by Moose::Meta::Role::Attribute::attach_to_role at line 59 of Moose/Meta/Role/Attribute.pm, avg 7µs/call
# 8 times (52µs+0s) by Moose::Meta::Class::create_anon_class at line 115 of Moose/Meta/Class.pm, avg 6µs/call
# 2 times (18µs+0s) by Class::MOP::Instance::weaken_slot_value at line 146 of Class/MOP/Instance.pm, avg 9µs/call |