| 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.20ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 13441 | 41 | 26 | 80.6ms | 80.6ms | Scalar::Util::blessed (xsub) |
| 7901 | 8 | 4 | 43.7ms | 43.7ms | Scalar::Util::reftype (xsub) |
| 2946 | 14 | 11 | 21.3ms | 21.3ms | Scalar::Util::weaken (xsub) |
| 1 | 1 | 1 | 1.51ms | 3.36ms | Scalar::Util::BEGIN@10 |
| 203 | 1 | 1 | 1.24ms | 1.24ms | Scalar::Util::isweak (xsub) |
| 224 | 3 | 2 | 1.02ms | 1.02ms | Scalar::Util::refaddr (xsub) |
| 1 | 1 | 1 | 79µs | 99µ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 | 120µs | 2 | 118µs | # spent 99µs (79+19) within Scalar::Util::BEGIN@9 which was called:
# once (79µs+19µs) by Moose::BEGIN@11 at line 9 # spent 99µs making 1 call to Scalar::Util::BEGIN@9
# spent 19µs making 1 call to strict::import |
| 10 | 3 | 1.47ms | 2 | 3.78ms | # spent 3.36ms (1.51+1.85) within Scalar::Util::BEGIN@10 which was called:
# once (1.51ms+1.85ms) by Moose::BEGIN@11 at line 10 # spent 3.36ms making 1 call to Scalar::Util::BEGIN@10
# spent 422µs making 1 call to vars::import |
| 11 | 1 | 2.18ms | require Exporter; | ||
| 12 | 1 | 280µ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 | 72µ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 | 27µs | 1; | ||
| 67 | |||||
| 68 | __END__ | ||||
# spent 80.6ms within Scalar::Util::blessed which was called 13441 times, avg 6µs/call:
# 4341 times (27.2ms+0s) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 150 of Class/MOP/Mixin/HasMethods.pm, avg 6µs/call
# 1705 times (9.21ms+0s) by Class::MOP::Mixin::HasMethods::get_method at line 124 of Class/MOP/Mixin/HasMethods.pm, avg 5µs/call
# 1642 times (10.4ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 65 of Class/MOP/Mixin/HasMethods.pm, avg 6µs/call
# 1065 times (6.16ms+0s) by Class::MOP::Method::clone at line 133 of Class/MOP/Method.pm, avg 6µs/call
# 635 times (3.44ms+0s) by Class::MOP::class_of at line 61 of Class/MOP.pm, avg 5µs/call
# 532 times (2.91ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 5µs/call
# 483 times (2.81ms+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
# 475 times (2.40ms+0s) by Moose::Util::TypeConstraints::find_type_constraint at line 256 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 364 times (2.53ms+0s) by Class::MOP::Method::Accessor::new at line 26 of Class/MOP/Method/Accessor.pm, avg 7µs/call
# 253 times (1.74ms+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21 of Class/MOP/Mixin/HasAttributes.pm, avg 7µs/call
# 238 times (1.31ms+0s) by Class::MOP::Attribute::attach_to_class at line 232 of Class/MOP/Attribute.pm, avg 6µs/call
# 179 times (958µs+0s) by Moose::Meta::Role::Composite::add_method at line 81 of Moose/Meta/Role/Composite.pm, avg 5µs/call
# 173 times (1.08ms+0s) by Class::MOP::Instance::BUILDARGS at line 21 of Class/MOP/Instance.pm, avg 6µs/call
# 172 times (1.30ms+0s) by Class::MOP::Class::_construct_instance at line 588 of Class/MOP/Class.pm, avg 8µs/call
# 132 times (933µs+0s) by Moose::Meta::TypeConstraint::Registry::add_type_constraint at line 47 of Moose/Meta/TypeConstraint/Registry.pm, avg 7µs/call
# 123 times (618µs+0s) by Moose::Meta::Class::add_attribute at line 300 of Moose/Meta/Class.pm, avg 5µs/call
# 100 times (550µs+0s) by Moose::Meta::Attribute::_process_isa_option at line 320 of Moose/Meta/Attribute.pm, avg 5µs/call
# 86 times (507µs+0s) by Moose::Util::_apply_all_roles at line 109 of Moose/Util.pm, avg 6µs/call
# 75 times (506µs+0s) by Class::MOP::Method::Wrapped::wrap at line 74 of Class/MOP/Method/Wrapped.pm, avg 7µs/call
# 73 times (382µs+0s) by Moose::Meta::Role::add_required_methods at line 254 of Moose/Meta/Role.pm, avg 5µs/call
# 72 times (535µs+0s) by Moose::Util::_apply_all_roles at line 133 of Moose/Util.pm, avg 7µs/call
# 72 times (429µs+0s) by Moose::Meta::Role::apply at line 436 of Moose/Meta/Role.pm, avg 6µs/call
# 72 times (336µ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
# 51 times (372µs+0s) by Moose::Meta::Role::add_role at line 397 of Moose/Meta/Role.pm, avg 7µs/call
# 33 times (169µs+0s) by Class::MOP::Object::meta at line 18 of Class/MOP/Object.pm, avg 5µs/call
# 31 times (187µs+0s) by Class::MOP::Method::Constructor::new at line 20 of Class/MOP/Method/Constructor.pm, avg 6µs/call
# 30 times (151µs+0s) by Moose::Meta::Role::add_attribute at line 232 of Moose/Meta/Role.pm, avg 5µs/call
# 24 times (160µs+0s) by Moose::Meta::Method::Destructor::is_needed at line 58 of Moose/Meta/Method/Destructor.pm, avg 7µs/call
# 24 times (137µs+0s) by Moose::Meta::Role::combine at line 496 of Moose/Meta/Role.pm, avg 6µs/call
# 24 times (123µ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
# 23 times (135µs+0s) by Moose::Meta::Method::Delegation::new at line 25 of Moose/Meta/Method/Delegation.pm, avg 6µs/call
# 23 times (113µ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 (192µs+0s) by Moose::Meta::Class::add_role at line 179 of Moose/Meta/Class.pm, avg 9µs/call
# 21 times (106µs+0s) by Moose::Meta::Class::add_role_application at line 192 of Moose/Meta/Class.pm, avg 5µs/call
# 18 times (93µs+0s) by Class::MOP::Mixin::meta at line 14 of Class/MOP/Mixin.pm, avg 5µs/call
# 17 times (90µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 15 times (191µs+0s) by Moose::Meta::Role::Attribute::attach_to_role at line 55 of Moose/Meta/Role/Attribute.pm, avg 13µs/call
# 11 times (57µs+0s) by Moose::Meta::Attribute::_process_does_option at line 337 of Moose/Meta/Attribute.pm, avg 5µs/call
# 10 times (74µs+0s) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 46 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 7µs/call
# 2 times (14µs+0s) by Moose::Meta::Attribute::_weaken_value at line 568 of Moose/Meta/Attribute.pm, avg 7µs/call
# once (7µs+0s) by Moose::Object::new at line 22 of Moose/Object.pm | |||||
# spent 1.24ms within Scalar::Util::isweak which was called 203 times, avg 6µs/call:
# 203 times (1.24ms+0s) by Class::MOP::metaclass_is_weak at line 54 of Class/MOP.pm, avg 6µs/call | |||||
# spent 1.02ms within Scalar::Util::refaddr which was called 224 times, avg 5µs/call:
# 174 times (765µs+0s) by Moose::Meta::TypeConstraint::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint.pm:8] at line 8 of Moose/Meta/TypeConstraint.pm, avg 4µs/call
# 48 times (241µs+0s) by Class::MOP::Method::Inlined::can_be_inlined at line 74 of Class/MOP/Method/Inlined.pm, avg 5µs/call
# 2 times (10µs+0s) by Class::MOP::Method::Inlined::can_be_inlined at line 79 of Class/MOP/Method/Inlined.pm, avg 5µs/call | |||||
# spent 43.7ms within Scalar::Util::reftype which was called 7901 times, avg 6µs/call:
# 3590 times (20.2ms+0s) by Package::Stash::has_package_symbol at line 134 of Package/Stash.pm, avg 6µs/call
# 1695 times (10.00ms+0s) by Package::Stash::_valid_for_type at line 69 of Package/Stash.pm, avg 6µs/call
# 1386 times (7.03ms+0s) by Sub::Install::_CODELIKE at line 98 of Sub/Install.pm, avg 5µs/call
# 679 times (3.52ms+0s) by Package::Stash::_valid_for_type at line 74 of Package/Stash.pm, avg 5µs/call
# 532 times (2.85ms+0s) by Class::MOP::Method::wrap at line 31 of Class/MOP/Method.pm, avg 5µs/call
# 16 times (96µ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 6µs/call
# once (6µs+0s) by Moose::Util::TypeConstraints::subtype at line 303 of Moose/Util/TypeConstraints.pm | |||||
# spent 21.3ms within Scalar::Util::weaken which was called 2946 times, avg 7µs/call:
# 1619 times (10.3ms+0s) by Class::MOP::Method::attach_to_class at line 75 of Class/MOP/Method.pm, avg 6µs/call
# 383 times (3.21ms+0s) by Class::MOP::Method::wrap at line 46 of Class/MOP/Method.pm, avg 8µs/call
# 364 times (3.52ms+0s) by Class::MOP::Method::Accessor::new at line 37 of Class/MOP/Method/Accessor.pm, avg 10µs/call
# 238 times (1.75ms+0s) by Class::MOP::Attribute::attach_to_class at line 234 of Class/MOP/Attribute.pm, avg 7µs/call
# 173 times (1.27ms+0s) by Class::MOP::Instance::new at line 45 of Class/MOP/Instance.pm, avg 7µs/call
# 31 times (238µs+0s) by Class::MOP::Method::Constructor::new at line 32 of Class/MOP/Method/Constructor.pm, avg 8µs/call
# 24 times (188µs+0s) by Moose::Meta::Method::Constructor::new at line 40 of Moose/Meta/Method/Constructor.pm, avg 8µs/call
# 24 times (178µs+0s) by Moose::Meta::Method::Destructor::new at line 41 of Moose/Meta/Method/Destructor.pm, avg 7µs/call
# 23 times (148µs+0s) by Moose::Meta::Method::Delegation::new at line 48 of Moose/Meta/Method/Delegation.pm, avg 6µs/call
# 21 times (157µ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 (122µs+0s) by Moose::Meta::Role::Application::ToClass::apply at line 29 of Moose/Meta/Role/Application/ToClass.pm, avg 6µs/call
# 15 times (109µ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 (48µs+0s) by Moose::Meta::Class::create_anon_class at line 115 of Moose/Meta/Class.pm, avg 6µs/call
# 2 times (19µs+0s) by Class::MOP::Instance::weaken_slot_value at line 148 of Class/MOP/Instance.pm, avg 9µs/call |