← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:47 2015

Filename/usr/share/perl/5.20/Module/Load.pm
StatementsExecuted 24 statements in 693µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11116µs18µsModule::Load::::importModule::Load::import
11112µs24µsModule::Load::::BEGIN@5Module::Load::BEGIN@5
1118µs15µsModule::Load::::BEGIN@6Module::Load::BEGIN@6
1116µs16µsModule::Load::::BEGIN@88Module::Load::BEGIN@88
1116µs14µsModule::Load::::BEGIN@13Module::Load::BEGIN@13
1113µs3µsModule::Load::::BEGIN@7Module::Load::BEGIN@7
1112µs2µsModule::Load::::_whoModule::Load::_who
0000s0sModule::Load::::_is_fileModule::Load::_is_file
0000s0sModule::Load::::_loadModule::Load::_load
0000s0sModule::Load::::_to_fileModule::Load::_to_file
0000s0sModule::Load::::autoloadModule::Load::autoload
0000s0sModule::Load::::autoload_remoteModule::Load::autoload_remote
0000s0sModule::Load::::loadModule::Load::load
0000s0sModule::Load::::load_remoteModule::Load::load_remote
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Module::Load;
2
31400ns$VERSION = '0.32';
4
5225µs237µs
# spent 24µs (12+12) within Module::Load::BEGIN@5 which was called: # once (12µs+12µs) by Module::Load::Conditional::BEGIN@5 at line 5
use strict;
# spent 24µs making 1 call to Module::Load::BEGIN@5 # spent 12µs making 1 call to strict::import
6221µs221µs
# spent 15µs (8+7) within Module::Load::BEGIN@6 which was called: # once (8µs+7µs) by Module::Load::Conditional::BEGIN@5 at line 6
use warnings;
# spent 15µs making 1 call to Module::Load::BEGIN@6 # spent 7µs making 1 call to warnings::import
7241µs13µs
# spent 3µs within Module::Load::BEGIN@7 which was called: # once (3µs+0s) by Module::Load::Conditional::BEGIN@5 at line 7
use File::Spec ();
# spent 3µs making 1 call to Module::Load::BEGIN@7
8
9
# spent 18µs (16+2) within Module::Load::import which was called: # once (16µs+2µs) by Module::Load::Conditional::BEGIN@5 at line 5 of Module/Load/Conditional.pm
sub import {
1011µs12µs my $who = _who();
# spent 2µs making 1 call to Module::Load::_who
112200ns my $h; shift;
12
133370µs223µs
# spent 14µs (6+9) within Module::Load::BEGIN@13 which was called: # once (6µs+9µs) by Module::Load::Conditional::BEGIN@5 at line 13
{ no strict 'refs';
# spent 14µs making 1 call to Module::Load::BEGIN@13 # spent 9µs making 1 call to strict::unimport
14
15 @_ or (
16 *{"${who}::load"} = \&load, # compat to prev version
171400ns *{"${who}::autoload"} = \&autoload,
18 return
19 );
20
2112µs map { $h->{$_} = () if defined $_ } @_;
22
231400ns (exists $h->{none} or exists $h->{''})
24 and shift, last;
25
26 ((exists $h->{autoload} and shift,1) or (exists $h->{all} and shift))
271400ns and *{"${who}::autoload"} = \&autoload;
28
29 ((exists $h->{load} and shift,1) or exists $h->{all})
3013µs and *{"${who}::load"} = \&load;
31
32 ((exists $h->{load_remote} and shift,1) or exists $h->{all})
331300ns and *{"${who}::load_remote"} = \&load_remote;
34
35 ((exists $h->{autoload_remote} and shift,1) or exists $h->{all})
3612µs and *{"${who}::autoload_remote"} = \&autoload_remote;
37
38 }
39
40}
41
42sub load(*;@){
43 goto &_load;
44}
45
46sub autoload(*;@){
47 unshift @_, 'autoimport';
48 goto &_load;
49}
50
51sub load_remote($$;@){
52 my ($dst, $src, @exp) = @_;
53
54 eval "package $dst;Module::Load::load('$src', qw/@exp/);";
55 $@ && die "$@";
56}
57
58sub autoload_remote($$;@){
59 my ($dst, $src, @exp) = @_;
60
61 eval "package $dst;Module::Load::autoload('$src', qw/@exp/);";
62 $@ && die "$@";
63}
64
65sub _load{
66 my $autoimport = $_[0] eq 'autoimport' and shift;
67 my $mod = shift or return;
68 my $who = _who();
69
70 if( _is_file( $mod ) ) {
71 require $mod;
72 } else {
73 LOAD: {
74 my $err;
75 for my $flag ( qw[1 0] ) {
76 my $file = _to_file( $mod, $flag);
77 eval { require $file };
78 $@ ? $err .= $@ : last LOAD;
79 }
80 die $err if $err;
81 }
82 }
83
84 ### This addresses #41883: Module::Load cannot import
85 ### non-Exporter module. ->import() routines weren't
86 ### properly called when load() was used.
87
882216µs225µs
# spent 16µs (6+9) within Module::Load::BEGIN@88 which was called: # once (6µs+9µs) by Module::Load::Conditional::BEGIN@5 at line 88
{ no strict 'refs';
# spent 16µs making 1 call to Module::Load::BEGIN@88 # spent 9µs making 1 call to strict::unimport
89 my $import;
90
91 ((@_ or $autoimport) and (
92 $import = $mod->can('import')
93 ) and (
94 unshift(@_, $mod),
95 goto &$import,
96 return
97 )
98 );
99 }
100
101}
102
103sub _to_file{
104 local $_ = shift;
105 my $pm = shift || '';
106
107 ## trailing blanks ignored by default. [rt #69886]
108 my @parts = split /::|'/, $_, -1;
109 ## make sure that we can't hop out of @INC
110 shift @parts if @parts && !$parts[0];
111
112 ### because of [perl #19213], see caveats ###
113 my $file = $^O eq 'MSWin32'
114 ? join "/", @parts
115 : File::Spec->catfile( @parts );
116
117 $file .= '.pm' if $pm;
118
119 ### on perl's before 5.10 (5.9.5@31746) if you require
120 ### a file in VMS format, it's stored in %INC in VMS
121 ### format. Therefor, better unixify it first
122 ### Patch in reply to John Malmbergs patch (as mentioned
123 ### above) on p5p Tue 21 Aug 2007 04:55:07
124 $file = VMS::Filespec::unixify($file) if $^O eq 'VMS';
125
126 return $file;
127}
128
12916µs
# spent 2µs within Module::Load::_who which was called: # once (2µs+0s) by Module::Load::import at line 10
sub _who { (caller(1))[0] }
130
131sub _is_file {
132 local $_ = shift;
133 return /^\./ ? 1 :
134 /[^\w:']/ ? 1 :
135 undef
136}
137
- -
14012µs1;
141
142__END__