Filename | /Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/Module/Load.pm |
Statements | Executed 38 statements in 1.40ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.57ms | 1.97ms | _load | Module::Load::
1 | 1 | 1 | 32µs | 58µs | _to_file | Module::Load::
1 | 1 | 1 | 24µs | 26µs | BEGIN@3 | Module::Load::
1 | 1 | 1 | 14µs | 20µs | _is_file | Module::Load::
1 | 1 | 1 | 10µs | 10µs | _who | Module::Load::
1 | 1 | 1 | 7µs | 10µs | BEGIN@89 | Module::Load::
1 | 1 | 1 | 6µs | 11µs | BEGIN@14 | Module::Load::
2 | 1 | 1 | 6µs | 6µs | CORE:match (opcode) | Module::Load::
1 | 1 | 1 | 5µs | 24µs | BEGIN@4 | Module::Load::
1 | 1 | 1 | 4µs | 4µs | load | Module::Load::
1 | 1 | 1 | 2µs | 2µs | BEGIN@5 | Module::Load::
0 | 0 | 0 | 0s | 0s | autoload | Module::Load::
0 | 0 | 0 | 0s | 0s | autoload_remote | Module::Load::
0 | 0 | 0 | 0s | 0s | import | Module::Load::
0 | 0 | 0 | 0s | 0s | load_remote | Module::Load::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Module::Load; | ||||
2 | |||||
3 | 2 | 25µs | 2 | 28µs | # spent 26µs (24+2) within Module::Load::BEGIN@3 which was called:
# once (24µs+2µs) by YAML::PP::Schema::BEGIN@5 at line 3 # spent 26µs making 1 call to Module::Load::BEGIN@3
# spent 2µs making 1 call to strict::import |
4 | 2 | 13µs | 2 | 43µs | # spent 24µs (5+19) within Module::Load::BEGIN@4 which was called:
# once (5µs+19µs) by YAML::PP::Schema::BEGIN@5 at line 4 # spent 24µs making 1 call to Module::Load::BEGIN@4
# spent 19µs making 1 call to warnings::import |
5 | 2 | 38µs | 1 | 2µs | # spent 2µs within Module::Load::BEGIN@5 which was called:
# once (2µs+0s) by YAML::PP::Schema::BEGIN@5 at line 5 # spent 2µs making 1 call to Module::Load::BEGIN@5 |
6 | |||||
7 | 1 | 0s | our $VERSION = '0.36'; | ||
8 | |||||
9 | |||||
10 | sub import { | ||||
11 | my $who = _who(); | ||||
12 | my $h; shift; | ||||
13 | |||||
14 | 2 | 319µs | 2 | 16µs | # spent 11µs (6+5) within Module::Load::BEGIN@14 which was called:
# once (6µs+5µs) by YAML::PP::Schema::BEGIN@5 at line 14 # spent 11µs making 1 call to Module::Load::BEGIN@14
# spent 5µ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 | ||||
44 | 1 | 10µs | 1 | 1.97ms | goto &_load; # spent 1.97ms making 1 call to Module::Load::_load |
45 | } | ||||
46 | |||||
47 | sub autoload(*;@){ | ||||
48 | unshift @_, 'autoimport'; | ||||
49 | goto &_load; | ||||
50 | } | ||||
51 | |||||
52 | sub load_remote($$;@){ | ||||
53 | my ($dst, $src, @exp) = @_; | ||||
54 | |||||
55 | eval "package $dst;Module::Load::load('$src', qw/@exp/);"; | ||||
56 | $@ && die "$@"; | ||||
57 | } | ||||
58 | |||||
59 | sub autoload_remote($$;@){ | ||||
60 | my ($dst, $src, @exp) = @_; | ||||
61 | |||||
62 | eval "package $dst;Module::Load::autoload('$src', qw/@exp/);"; | ||||
63 | $@ && die "$@"; | ||||
64 | } | ||||
65 | |||||
66 | # spent 1.97ms (1.57+399µs) within Module::Load::_load which was called:
# once (1.57ms+399µs) by YAML::PP::Schema::load_subschemas at line 44 | ||||
67 | 1 | 2µs | my $autoimport = $_[0] eq 'autoimport' and shift; | ||
68 | 1 | 1µs | my $mod = shift or return; | ||
69 | 1 | 4µs | 1 | 10µs | my $who = _who(); # spent 10µs making 1 call to Module::Load::_who |
70 | |||||
71 | 1 | 2µs | 1 | 20µs | if( _is_file( $mod ) ) { # spent 20µs making 1 call to Module::Load::_is_file |
72 | require $mod; | ||||
73 | } else { | ||||
74 | LOAD: { | ||||
75 | 2 | 1µs | my $err; | ||
76 | 1 | 1µs | for my $flag ( qw[1 0] ) { | ||
77 | 1 | 2µs | 1 | 58µs | my $file = _to_file( $mod, $flag); # spent 58µs making 1 call to Module::Load::_to_file |
78 | 2 | 566µs | eval { require $file }; | ||
79 | 1 | 12µ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 | |||||
89 | 3 | 306µs | 2 | 13µs | # spent 10µs (7+3) within Module::Load::BEGIN@89 which was called:
# once (7µs+3µs) by YAML::PP::Schema::BEGIN@5 at line 89 # spent 10µs making 1 call to Module::Load::BEGIN@89
# spent 3µs making 1 call to strict::unimport |
90 | 1 | 0s | my $import; | ||
91 | |||||
92 | 1 | 1µ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 58µs (32+26) within Module::Load::_to_file which was called:
# once (32µs+26µs) by Module::Load::_load at line 77 | ||||
104 | 1 | 0s | local $_ = shift; | ||
105 | 1 | 1µs | my $pm = shift || ''; | ||
106 | |||||
107 | ## trailing blanks ignored by default. [rt #69886] | ||||
108 | 1 | 12µs | my @parts = split /::|'/, $_, -1; | ||
109 | ## make sure that we can't hop out of @INC | ||||
110 | 1 | 1µs | shift @parts if @parts && !$parts[0]; | ||
111 | |||||
112 | ### because of [perl #19213], see caveats ### | ||||
113 | 1 | 39µs | 4 | 36µs | my $file = $^O eq 'MSWin32' # spent 26µs making 1 call to File::Spec::Unix::catfile
# spent 7µs making 1 call to File::Spec::Unix::catdir
# spent 3µs making 2 calls to File::Spec::Unix::canonpath, avg 2µs/call |
114 | ? join "/", @parts | ||||
115 | : File::Spec->catfile( @parts ); | ||||
116 | |||||
117 | 1 | 1µs | $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 | 1 | 1µs | $file = VMS::Filespec::unixify($file) if $^O eq 'VMS'; | ||
125 | |||||
126 | 1 | 6µs | return $file; | ||
127 | } | ||||
128 | |||||
129 | 1 | 12µs | # spent 10µs within Module::Load::_who which was called:
# once (10µs+0s) by Module::Load::_load at line 69 | ||
130 | |||||
131 | # spent 20µs (14+6) within Module::Load::_is_file which was called:
# once (14µs+6µs) by Module::Load::_load at line 71 | ||||
132 | 1 | 1µs | local $_ = shift; | ||
133 | 1 | 21µs | 2 | 6µs | return /^\./ ? 1 : # spent 6µs making 2 calls to Module::Load::CORE:match, avg 3µs/call |
134 | /[^\w:']/ ? 1 : | ||||
135 | undef | ||||
136 | } | ||||
137 | |||||
- - | |||||
140 | 1 | 3µs | 1; | ||
141 | |||||
142 | __END__ | ||||
# spent 6µs within Module::Load::CORE:match which was called 2 times, avg 3µs/call:
# 2 times (6µs+0s) by Module::Load::_is_file at line 133, avg 3µs/call |