← Index
NYTProf Performance Profile   « block view • line view • sub view »
For reply.pl
  Run on Thu Oct 21 22:40:13 2010
Reported on Thu Oct 21 22:44:38 2010

Filename/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/5.13.5/x86_64-linux/Scalar/Util.pm
StatementsExecuted 12 statements in 497µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
62842986µs986µsScalar::Util::::reftypeScalar::Util::reftype (xsub)
414483µs83µsScalar::Util::::weakenScalar::Util::weaken (xsub)
434468µs68µsScalar::Util::::blessedScalar::Util::blessed (xsub)
11125µs30µsScalar::Util::::BEGIN@9Scalar::Util::BEGIN@9
11110µs111µsScalar::Util::::BEGIN@10Scalar::Util::BEGIN@10
21110µs10µsScalar::Util::::refaddrScalar::Util::refaddr (xsub)
0000s0sScalar::Util::::export_failScalar::Util::export_fail
0000s0sScalar::Util::::openhandleScalar::Util::openhandle
Call graph for these subroutines as a Graphviz dot language file.
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
7package Scalar::Util;
8
9231µs236µs
# spent 30µs (25+5) within Scalar::Util::BEGIN@9 which was called: # once (25µs+5µs) by Tie::RefHash::BEGIN@96 at line 9
use strict;
# spent 30µs making 1 call to Scalar::Util::BEGIN@9 # spent 5µs making 1 call to strict::import
102297µs2212µs
# spent 111µs (10+101) within Scalar::Util::BEGIN@10 which was called: # once (10µs+101µs) by Tie::RefHash::BEGIN@96 at line 10
use vars qw(@ISA @EXPORT_OK $VERSION @EXPORT_FAIL);
# spent 111µs making 1 call to Scalar::Util::BEGIN@10 # spent 101µs making 1 call to vars::import
1111µsrequire Exporter;
121126µsrequire List::Util; # List::Util loads the XS
13
1417µs@ISA = qw(Exporter);
1514µs@EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number set_prototype);
1611µs$VERSION = "1.23";
17121µs$VERSION = eval $VERSION;
# spent 2µs executing statements in string eval
18
1911µsunless (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
26sub 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
48sub 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
6619µs1;
67
68__END__
 
# spent 68µs within Scalar::Util::blessed which was called 43 times, avg 2µs/call: # 36 times (54µs+0s) by Mouse::Meta::Class::add_attribute at line 205 of Mouse/Meta/Class.pm, avg 1µs/call # 3 times (6µs+0s) by Mouse::Util::TypeConstraints::__ANON__[/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/x86_64-linux/Mouse/Util/TypeConstraints.pm:217] at line 215 of Mouse/Util/TypeConstraints.pm, avg 2µs/call # 3 times (5µs+0s) by Mouse::Util::apply_all_roles at line 276 of Mouse/Util.pm, avg 2µs/call # once (3µs+0s) by Hailo::DEMOLISH at line 340 of Hailo.pm
sub Scalar::Util::blessed; # xsub
# spent 10µs within Scalar::Util::refaddr which was called 2 times, avg 5µs/call: # 2 times (10µs+0s) by Tie::RefHash::STORE at line 211 of Tie/RefHash.pm, avg 5µs/call
sub Scalar::Util::refaddr; # xsub
# spent 986µs within Scalar::Util::reftype which was called 628 times, avg 2µs/call: # 515 times (811µs+0s) by Package::Stash::has_package_symbol at line 134 of Package/Stash.pm, avg 2µs/call # 103 times (152µs+0s) by Package::Stash::_valid_for_type at line 74 of Package/Stash.pm, avg 1µs/call # 7 times (16µs+0s) by Package::Stash::_valid_for_type at line 69 of Package/Stash.pm, avg 2µs/call # 3 times (7µs+0s) by Sub::Install::_CODELIKE at line 98 of Sub/Install.pm, avg 2µs/call
sub Scalar::Util::reftype; # xsub
# spent 83µs within Scalar::Util::weaken which was called 41 times, avg 2µs/call: # 36 times (69µs+0s) by Mouse::Meta::Class::add_attribute at line 236 of Mouse/Meta/Class.pm, avg 2µs/call # 3 times (7µs+0s) by Mouse::Meta::Module::create at line 231 of Mouse/Meta/Module.pm, avg 2µs/call # once (4µs+0s) by Hailo::Storage::BEGIN@12 at line 292 of DBI.pm # once (3µs+0s) by Hailo::__ANON__[/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/Hailo.pm:176] at line 148 of Hailo.pm
sub Scalar::Util::weaken; # xsub