← Index
NYTProf Performance Profile   « line view »
For split.pl
  Run on Thu Apr 20 02:05:47 2023
Reported on Thu Apr 20 18:31:09 2023

Filename/usr/share/perl/5.36/Module/Load.pm
StatementsExecuted 24 statements in 606µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1119µs18µsModule::Load::::importModule::Load::import
1117µs8µsModule::Load::::BEGIN@3Module::Load::BEGIN@3
1115µs8µsModule::Load::::BEGIN@89Module::Load::BEGIN@89
1114µs8µsModule::Load::::BEGIN@14Module::Load::BEGIN@14
1114µs9µsModule::Load::::_whoModule::Load::_who
1113µs17µsModule::Load::::BEGIN@4Module::Load::BEGIN@4
1112µs2µsModule::Load::::BEGIN@5Module::Load::BEGIN@5
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
3215µs29µs
# spent 8µs (7+900ns) within Module::Load::BEGIN@3 which was called: # once (7µs+900ns) by Module::Load::Conditional::BEGIN@5 at line 3
use strict;
# spent 8µs making 1 call to Module::Load::BEGIN@3 # spent 900ns making 1 call to strict::import
4216µs231µs
# spent 17µs (3+14) within Module::Load::BEGIN@4 which was called: # once (3µs+14µs) by Module::Load::Conditional::BEGIN@5 at line 4
use warnings;
# spent 17µs making 1 call to Module::Load::BEGIN@4 # spent 14µs making 1 call to warnings::import
5231µs12µs
# spent 2µs within Module::Load::BEGIN@5 which was called: # once (2µs+0s) by Module::Load::Conditional::BEGIN@5 at line 5
use File::Spec ();
# spent 2µs making 1 call to Module::Load::BEGIN@5
6
71200nsour $VERSION = '0.36';
8
9
10
# spent 18µs (9+9) within Module::Load::import which was called: # once (9µs+9µs) by Module::Load::Conditional::BEGIN@5 at line 5 of Module/Load/Conditional.pm
sub import {
111600ns19µs my $who = _who();
# spent 9µs making 1 call to Module::Load::_who
122200ns my $h; shift;
13
143290µs212µs
# spent 8µs (4+4) within Module::Load::BEGIN@14 which was called: # once (4µs+4µs) by Module::Load::Conditional::BEGIN@5 at line 14
{ no strict 'refs';
# spent 8µs making 1 call to Module::Load::BEGIN@14 # spent 4µs making 1 call to strict::unimport
15
16 @_ or (
17 *{"${who}::load"} = \&load, # compat to prev version
181100ns *{"${who}::autoload"} = \&autoload,
19 return
20 );
21
2212µs map { $h->{$_} = () if defined $_ } @_;
23
241400ns (exists $h->{none} or exists $h->{''})
25 and shift, last;
26
27 ((exists $h->{autoload} and shift,1) or (exists $h->{all} and shift))
281100ns and *{"${who}::autoload"} = \&autoload;
29
30 ((exists $h->{load} and shift,1) or exists $h->{all})
3112µs and *{"${who}::load"} = \&load;
32
33 ((exists $h->{load_remote} and shift,1) or exists $h->{all})
341200ns and *{"${who}::load_remote"} = \&load_remote;
35
36 ((exists $h->{autoload_remote} and shift,1) or exists $h->{all})
3711µs and *{"${who}::autoload_remote"} = \&autoload_remote;
38
39 }
40
41}
42
43sub load(*;@){
44 goto &_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
66sub _load{
67 my $autoimport = $_[0] eq 'autoimport' and shift;
68 my $mod = shift or return;
69 my $who = _who();
70
71 if( _is_file( $mod ) ) {
72 require $mod;
73 } else {
74 LOAD: {
75 my $err;
76 for my $flag ( qw[1 0] ) {
77 my $file = _to_file( $mod, $flag);
78 eval { require $file };
79 $@ ? $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
892243µs212µs
# spent 8µs (5+3) within Module::Load::BEGIN@89 which was called: # once (5µs+3µs) by Module::Load::Conditional::BEGIN@5 at line 89
{ no strict 'refs';
# spent 8µs making 1 call to Module::Load::BEGIN@89 # spent 3µs making 1 call to strict::unimport
90 my $import;
91
92 ((@_ or $autoimport) and (
93 $import = $mod->can('import')
94 ) and (
95 unshift(@_, $mod),
96 goto &$import
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
12913µs16µs
# spent 9µs (4+6) within Module::Load::_who which was called: # once (4µs+6µs) by Module::Load::import at line 11
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__