← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:42:38 2010
Reported on Wed Nov 17 22:07:22 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Params/Util.pm
StatementsExecuted 47 statements in 7.97ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1088425.46ms5.46msParams::Util::::_CODELIKEParams::Util::_CODELIKE (xsub)
14521701µs701µsParams::Util::::_SCALAR0Params::Util::_SCALAR0 (xsub)
111104µs104µsParams::Util::::BEGIN@58Params::Util::BEGIN@58
11196µs96µsParams::Util::::bootstrapParams::Util::bootstrap (xsub)
111172µs72µsParams::Util::::_HASHLIKEParams::Util::_HASHLIKE (xsub)
111154µs54µsParams::Util::::_ARRAYLIKEParams::Util::_ARRAYLIKE (xsub)
11144µs96µsParams::Util::::BEGIN@59Params::Util::BEGIN@59
11137µs337µsParams::Util::::BEGIN@65Params::Util::BEGIN@65
31126µs26µsParams::Util::::_HASHParams::Util::_HASH (xsub)
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Params::Util;
2
3=pod
4
- -
583151µs1104µs
# spent 104µs within Params::Util::BEGIN@58 which was called: # once (104µs+0s) by Package::DeprecationManager::BEGIN@11 at line 58
use 5.00503;
# spent 104µs making 1 call to Params::Util::BEGIN@58
593173µs2148µs
# spent 96µs (44+52) within Params::Util::BEGIN@59 which was called: # once (44µs+52µs) by Package::DeprecationManager::BEGIN@11 at line 59
use strict;
# spent 96µs making 1 call to Params::Util::BEGIN@59 # spent 52µs making 1 call to strict::import
6012.93msrequire overload;
6115µsrequire Exporter;
6213µsrequire Scalar::Util;
6313µsrequire DynaLoader;
64
6531.65ms2638µs
# spent 337µs (37+301) within Params::Util::BEGIN@65 which was called: # once (37µs+301µs) by Package::DeprecationManager::BEGIN@11 at line 65
use vars qw{$VERSION @ISA @EXPORT_OK %EXPORT_TAGS};
# spent 337µs making 1 call to Params::Util::BEGIN@65 # spent 301µs making 1 call to vars::import
66
6714µs$VERSION = '1.01';
68146µs@ISA = qw{
69 Exporter
70 DynaLoader
71};
72120µs@EXPORT_OK = qw{
73 _STRING _IDENTIFIER
74 _CLASS _CLASSISA _SUBCLASS _DRIVER
75 _NUMBER _POSINT _NONNEGINT
76 _SCALAR _SCALAR0
77 _ARRAY _ARRAY0 _ARRAYLIKE
78 _HASH _HASH0 _HASHLIKE
79 _CODE _CODELIKE
80 _INVOCANT _REGEX _INSTANCE
81 _SET _SET0
82 _HANDLE
83};
8416µs%EXPORT_TAGS = ( ALL => \@EXPORT_OK );
85
8618µseval {
8714µs local $ENV{PERL_DL_NONLAZY} = 0 if $ENV{PERL_DL_NONLAZY};
88131µs11.14ms bootstrap Params::Util $VERSION;
# spent 1.14ms making 1 call to DynaLoader::bootstrap
8913µs 1;
90} unless $ENV{PERL_PARAMS_UTIL_PP};
91
- -
96#####################################################################
97# Param Checking Functions
98
99=pod
100
- -
12414µseval <<'END_PERL' unless defined &_STRING;
125sub _STRING ($) {
126 (defined $_[0] and ! ref $_[0] and length($_[0])) ? $_[0] : undef;
127}
128END_PERL
129
130=pod
131
- -
1431271µseval <<'END_PERL' unless defined &_IDENTIFIER;
144sub _IDENTIFIER ($) {
145 (defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*\z/s) ? $_[0] : undef;
146}
147END_PERL
148
149=pod
150
- -
1661206µseval <<'END_PERL' unless defined &_CLASS;
167sub _CLASS ($) {
168 (defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s) ? $_[0] : undef;
169}
170END_PERL
171
172=pod
173
- -
1921236µseval <<'END_PERL' unless defined &_CLASSISA;
# spent 0s executing statements in string eval
193sub _CLASSISA ($$) {
194 (defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s and $_[0]->isa($_[1])) ? $_[0] : undef;
195}
196END_PERL
197
198=pod
199
- -
2181501µseval <<'END_PERL' unless defined &_SUBCLASS;
219sub _SUBCLASS ($$) {
220 (defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s and $_[0] ne $_[1] and $_[0]->isa($_[1])) ? $_[0] : undef;
221}
222END_PERL
223
224=pod
225
- -
24014µseval <<'END_PERL' unless defined &_NUMBER;
241sub _NUMBER ($) {
242 ( defined $_[0] and ! ref $_[0] and Scalar::Util::looks_like_number($_[0]) )
243 ? $_[0]
244 : undef;
245}
246END_PERL
247
248=pod
249
- -
2641180µseval <<'END_PERL' unless defined &_POSINT;
265sub _POSINT ($) {
266 (defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[1-9]\d*$/) ? $_[0] : undef;
267}
268END_PERL
269
270=pod
271
- -
2941182µseval <<'END_PERL' unless defined &_NONNEGINT;
295sub _NONNEGINT ($) {
296 (defined $_[0] and ! ref $_[0] and $_[0] =~ m/^(?:0|[1-9]\d*)$/) ? $_[0] : undef;
297}
298END_PERL
299
300=pod
301
- -
31613µseval <<'END_PERL' unless defined &_SCALAR;
317sub _SCALAR ($) {
318 (ref $_[0] eq 'SCALAR' and defined ${$_[0]} and ${$_[0]} ne '') ? $_[0] : undef;
319}
320END_PERL
321
322=pod
323
- -
33812µseval <<'END_PERL' unless defined &_SCALAR0;
339sub _SCALAR0 ($) {
340 ref $_[0] eq 'SCALAR' ? $_[0] : undef;
341}
342END_PERL
343
344=pod
345
- -
36013µseval <<'END_PERL' unless defined &_ARRAY;
361sub _ARRAY ($) {
362 (ref $_[0] eq 'ARRAY' and @{$_[0]}) ? $_[0] : undef;
363}
364END_PERL
365
366=pod
367
- -
38313µseval <<'END_PERL' unless defined &_ARRAY0;
384sub _ARRAY0 ($) {
385 ref $_[0] eq 'ARRAY' ? $_[0] : undef;
386}
387END_PERL
388
389=pod
390
- -
39913µseval <<'END_PERL' unless defined &_ARRAYLIKE;
400sub _ARRAYLIKE {
401 (defined $_[0] and ref $_[0] and (
402 (Scalar::Util::reftype($_[0]) eq 'ARRAY')
403 or
404 overload::Method($_[0], '@{}')
405 )) ? $_[0] : undef;
406}
407END_PERL
408
409=pod
410
- -
42512µseval <<'END_PERL' unless defined &_HASH;
426sub _HASH ($) {
427 (ref $_[0] eq 'HASH' and scalar %{$_[0]}) ? $_[0] : undef;
428}
429END_PERL
430
431=pod
432
- -
44712µseval <<'END_PERL' unless defined &_HASH0;
448sub _HASH0 ($) {
449 ref $_[0] eq 'HASH' ? $_[0] : undef;
450}
451END_PERL
452
453=pod
454
- -
46312µseval <<'END_PERL' unless defined &_HASHLIKE;
464sub _HASHLIKE {
465 (defined $_[0] and ref $_[0] and (
466 (Scalar::Util::reftype($_[0]) eq 'HASH')
467 or
468 overload::Method($_[0], '%{}')
469 )) ? $_[0] : undef;
470}
471END_PERL
472
473=pod
474
- -
48612µseval <<'END_PERL' unless defined &_CODE;
487sub _CODE ($) {
488 ref $_[0] eq 'CODE' ? $_[0] : undef;
489}
490END_PERL
491
492=pod
493
- -
53412µseval <<'END_PERL' unless defined &_CODELIKE;
535sub _CODELIKE($) {
536 (
537 (Scalar::Util::reftype($_[0])||'') eq 'CODE'
538 or
539 Scalar::Util::blessed($_[0]) and overload::Method($_[0],'&{}')
540 )
541 ? $_[0] : undef;
542}
543END_PERL
544
545=pod
546
- -
5571224µseval <<'END_PERL' unless defined &_INVOCANT;
558sub _INVOCANT($) {
559 (defined $_[0] and
560 (defined Scalar::Util::blessed($_[0])
561 or
562 # We used to check for stash definedness, but any class-like name is a
563 # valid invocant for UNIVERSAL methods, so we stopped. -- rjbs, 2006-07-02
564 Params::Util::_CLASS($_[0]))
565 ) ? $_[0] : undef;
566}
567END_PERL
568
569=pod
570
- -
58213µseval <<'END_PERL' unless defined &_INSTANCE;
583sub _INSTANCE ($$) {
584 (Scalar::Util::blessed($_[0]) and $_[0]->isa($_[1])) ? $_[0] : undef;
585}
586END_PERL
587
588=pod
589
- -
60013µseval <<'END_PERL' unless defined &_REGEX;
601sub _REGEX ($) {
602 (defined $_[0] and 'Regexp' eq ref($_[0])) ? $_[0] : undef;
603}
604END_PERL
605
606=pod
607
- -
6251201µseval <<'END_PERL' unless defined &_SET;
626sub _SET ($$) {
627 my $set = shift;
628 _ARRAY($set) or return undef;
629 foreach my $item ( @$set ) {
630 _INSTANCE($item,$_[0]) or return undef;
631 }
632 $set;
633}
634END_PERL
635
636=pod
637
- -
6551185µseval <<'END_PERL' unless defined &_SET0;
656sub _SET0 ($$) {
657 my $set = shift;
658 _ARRAY0($set) or return undef;
659 foreach my $item ( @$set ) {
660 _INSTANCE($item,$_[0]) or return undef;
661 }
662 $set;
663}
664END_PERL
665
666=pod
667
- -
683# We're doing this longhand for now. Once everything is perfect,
684# we'll compress this into something that compiles more efficiently.
685# Further, testing file handles is not something that is generally
686# done millions of times, so doing it slowly is not a big speed hit.
6871399µseval <<'END_PERL' unless defined &_HANDLE;
688sub _HANDLE {
689 my $it = shift;
690
691 # It has to be defined, of course
692 unless ( defined $it ) {
693 return undef;
694 }
695
696 # Normal globs are considered to be file handles
697 if ( ref $it eq 'GLOB' ) {
698 return $it;
699 }
700
701 # Check for a normal tied filehandle
702 # Side Note: 5.5.4's tied() and can() doesn't like getting undef
703 if ( tied($it) and tied($it)->can('TIEHANDLE') ) {
704 return $it;
705 }
706
707 # There are no other non-object handles that we support
708 unless ( Scalar::Util::blessed($it) ) {
709 return undef;
710 }
711
712 # Check for a common base classes for conventional IO::Handle object
713 if ( $it->isa('IO::Handle') ) {
714 return $it;
715 }
716
717
718 # Check for tied file handles using Tie::Handle
719 if ( $it->isa('Tie::Handle') ) {
720 return $it;
721 }
722
723 # IO::Scalar is not a proper seekable, but it is valid is a
724 # regular file handle
725 if ( $it->isa('IO::Scalar') ) {
726 return $it;
727 }
728
729 # Yet another special case for IO::String, which refuses (for now
730 # anyway) to become a subclass of IO::Handle.
731 if ( $it->isa('IO::String') ) {
732 return $it;
733 }
734
735 # This is not any sort of object we know about
736 return undef;
737}
738END_PERL
739
740=pod
741
- -
7641211µseval <<'END_PERL' unless defined &_DRIVER;
765sub _DRIVER ($$) {
766 (defined _CLASS($_[0]) and eval "require $_[0];" and ! $@ and $_[0]->isa($_[1]) and $_[0] ne $_[1]) ? $_[0] : undef;
767}
768END_PERL
769
7701108µs1;
771
772=pod
773
- -
 
# spent 54µs within Params::Util::_ARRAYLIKE which was called 11 times, avg 5µs/call: # 11 times (54µs+0s) by Data::OptList::__is_a at line 146 of Data/OptList.pm, avg 5µs/call
sub Params::Util::_ARRAYLIKE; # xsub
# spent 5.46ms within Params::Util::_CODELIKE which was called 1088 times, avg 5µs/call: # 897 times (4.20ms+0s) by Sub::Exporter::default_generator at line 856 of Sub/Exporter.pm, avg 5µs/call # 140 times (981µs+0s) by Sub::Exporter::_expand_group at line 481 of Sub/Exporter.pm, avg 7µs/call # 46 times (244µs+0s) by Data::OptList::__is_a at line 146 of Data/OptList.pm, avg 5µs/call # 5 times (29µs+0s) by Sub::Exporter::_do_import at line 771 of Sub/Exporter.pm, avg 6µs/call
sub Params::Util::_CODELIKE; # xsub
# spent 26µs within Params::Util::_HASH which was called 3 times, avg 9µs/call: # 3 times (26µs+0s) by Package::DeprecationManager::import at line 18 of Package/DeprecationManager.pm, avg 9µs/call
sub Params::Util::_HASH; # xsub
# spent 72µs within Params::Util::_HASHLIKE which was called 11 times, avg 7µs/call: # 11 times (72µs+0s) by Data::OptList::__is_a at line 146 of Data/OptList.pm, avg 7µs/call
sub Params::Util::_HASHLIKE; # xsub
# spent 701µs within Params::Util::_SCALAR0 which was called 145 times, avg 5µs/call: # 140 times (666µs+0s) by Sub::Exporter::_expand_group at line 481 of Sub/Exporter.pm, avg 5µs/call # 5 times (36µs+0s) by Sub::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Sub/Exporter.pm:544] at line 536 of Sub/Exporter.pm, avg 7µs/call
sub Params::Util::_SCALAR0; # xsub
# spent 96µs within Params::Util::bootstrap which was called: # once (96µs+0s) by DynaLoader::bootstrap at line 223 of DynaLoader.pm
sub Params::Util::bootstrap; # xsub