← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 15:57:08 2022
Reported on Wed Dec 14 16:00:36 2022

Filename/Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/Module/Load.pm
StatementsExecuted 38 statements in 1.76ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.80ms2.23msModule::Load::::_loadModule::Load::_load
11129µs29µsModule::Load::::_whoModule::Load::_who
11120µs38µsModule::Load::::_to_fileModule::Load::_to_file
11116µs18µsModule::Load::::BEGIN@3Module::Load::BEGIN@3
11111µs16µsModule::Load::::_is_fileModule::Load::_is_file
1119µs15µsModule::Load::::BEGIN@89Module::Load::BEGIN@89
1118µs14µsModule::Load::::BEGIN@14Module::Load::BEGIN@14
1117µs26µsModule::Load::::BEGIN@4Module::Load::BEGIN@4
2115µs5µsModule::Load::::CORE:matchModule::Load::CORE:match (opcode)
1114µs4µsModule::Load::::BEGIN@5Module::Load::BEGIN@5
1114µs4µsModule::Load::::loadModule::Load::load
0000s0sModule::Load::::autoloadModule::Load::autoload
0000s0sModule::Load::::autoload_remoteModule::Load::autoload_remote
0000s0sModule::Load::::importModule::Load::import
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
3222µs220µs
# spent 18µs (16+2) within Module::Load::BEGIN@3 which was called: # once (16µs+2µs) by YAML::PP::Schema::BEGIN@5 at line 3
use strict;
# spent 18µs making 1 call to Module::Load::BEGIN@3 # spent 2µs making 1 call to strict::import
4220µs245µs
# spent 26µs (7+19) within Module::Load::BEGIN@4 which was called: # once (7µs+19µs) by YAML::PP::Schema::BEGIN@5 at line 4
use warnings;
# spent 26µs making 1 call to Module::Load::BEGIN@4 # spent 19µs making 1 call to warnings::import
5254µs14µs
# spent 4µs within Module::Load::BEGIN@5 which was called: # once (4µs+0s) by YAML::PP::Schema::BEGIN@5 at line 5
use File::Spec ();
# spent 4µs making 1 call to Module::Load::BEGIN@5
6
710sour $VERSION = '0.36';
8
9
10sub import {
11 my $who = _who();
12 my $h; shift;
13
142421µs220µs
# spent 14µs (8+6) within Module::Load::BEGIN@14 which was called: # once (8µs+6µs) by YAML::PP::Schema::BEGIN@5 at line 14
{ no strict 'refs';
# spent 14µs making 1 call to Module::Load::BEGIN@14 # spent 6µs making 1 call to strict::unimport
15
16 @_ or (
17 *{"${who}::load"} = \&load, # compat to prev version
18 *{"${who}::autoload"} = \&autoload,
19 return
20 );
21
22 map { $h->{$_} = () if defined $_ } @_;
23
24 (exists $h->{none} or exists $h->{''})
25 and shift, last;
26
27 ((exists $h->{autoload} and shift,1) or (exists $h->{all} and shift))
28 and *{"${who}::autoload"} = \&autoload;
29
30 ((exists $h->{load} and shift,1) or exists $h->{all})
31 and *{"${who}::load"} = \&load;
32
33 ((exists $h->{load_remote} and shift,1) or exists $h->{all})
34 and *{"${who}::load_remote"} = \&load_remote;
35
36 ((exists $h->{autoload_remote} and shift,1) or exists $h->{all})
37 and *{"${who}::autoload_remote"} = \&autoload_remote;
38
39 }
40
41}
42
43
# spent 4µs within Module::Load::load which was called: # once (4µs+0s) by YAML::PP::Schema::load_subschemas at line 139 of YAML/PP/Schema.pm
sub load(*;@){
4417µs12.23ms goto &_load;
# spent 2.23ms making 1 call to Module::Load::_load
45}
46
47sub autoload(*;@){
48 unshift @_, 'autoimport';
49 goto &_load;
50}
51
52sub load_remote($$;@){
53 my ($dst, $src, @exp) = @_;
54
55 eval "package $dst;Module::Load::load('$src', qw/@exp/);";
56 $@ && die "$@";
57}
58
59sub autoload_remote($$;@){
60 my ($dst, $src, @exp) = @_;
61
62 eval "package $dst;Module::Load::autoload('$src', qw/@exp/);";
63 $@ && die "$@";
64}
65
66
# spent 2.23ms (1.80+429µs) within Module::Load::_load which was called: # once (1.80ms+429µs) by YAML::PP::Schema::load_subschemas at line 44
sub _load{
6711µs my $autoimport = $_[0] eq 'autoimport' and shift;
6811µs my $mod = shift or return;
69121µs129µs my $who = _who();
# spent 29µs making 1 call to Module::Load::_who
70
7114µs116µs if( _is_file( $mod ) ) {
# spent 16µs making 1 call to Module::Load::_is_file
72 require $mod;
73 } else {
74 LOAD: {
7521µs my $err;
7611µs for my $flag ( qw[1 0] ) {
7712µs138µs my $file = _to_file( $mod, $flag);
# spent 38µs making 1 call to Module::Load::_to_file
782689µs eval { require $file };
7913µs $@ ? $err .= $@ : last LOAD;
80 }
81 die $err if $err;
82 }
83 }
84
85 ### This addresses #41883: Module::Load cannot import
86 ### non-Exporter module. ->import() routines weren't
87 ### properly called when load() was used.
88
893428µs221µs
# spent 15µs (9+6) within Module::Load::BEGIN@89 which was called: # once (9µs+6µs) by YAML::PP::Schema::BEGIN@5 at line 89
{ no strict 'refs';
# spent 15µs making 1 call to Module::Load::BEGIN@89 # spent 6µs making 1 call to strict::unimport
9010s my $import;
91
9211µs ((@_ or $autoimport) and (
93 $import = $mod->can('import')
94 ) and (
95 unshift(@_, $mod),
96 goto &$import
97 )
98 );
99 }
100
101}
102
103
# spent 38µs (20+18) within Module::Load::_to_file which was called: # once (20µs+18µs) by Module::Load::_load at line 77
sub _to_file{
10410s local $_ = shift;
10511µs my $pm = shift || '';
106
107 ## trailing blanks ignored by default. [rt #69886]
10817µs my @parts = split /::|'/, $_, -1;
109 ## make sure that we can't hop out of @INC
11010s shift @parts if @parts && !$parts[0];
111
112 ### because of [perl #19213], see caveats ###
113127µs425µs my $file = $^O eq 'MSWin32'
# spent 18µs making 1 call to File::Spec::Unix::catfile # spent 5µs making 1 call to File::Spec::Unix::catdir # spent 2µs making 2 calls to File::Spec::Unix::canonpath, avg 1µs/call
114 ? join "/", @parts
115 : File::Spec->catfile( @parts );
116
11710s $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
12410s $file = VMS::Filespec::unixify($file) if $^O eq 'VMS';
125
12615µs return $file;
127}
128
129127µs
# spent 29µs within Module::Load::_who which was called: # once (29µs+0s) by Module::Load::_load at line 69
sub _who { (caller(1))[0] }
130
131
# spent 16µs (11+5) within Module::Load::_is_file which was called: # once (11µs+5µs) by Module::Load::_load at line 71
sub _is_file {
13211µs local $_ = shift;
133116µs25µs return /^\./ ? 1 :
# spent 5µs making 2 calls to Module::Load::CORE:match, avg 2µs/call
134 /[^\w:']/ ? 1 :
135 undef
136}
137
- -
14013µs1;
141
142__END__
 
# spent 5µs within Module::Load::CORE:match which was called 2 times, avg 2µs/call: # 2 times (5µs+0s) by Module::Load::_is_file at line 133, avg 2µs/call
sub Module::Load::CORE:match; # opcode