Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/Module/Load.pm |
Statements | Executed 38 statements in 614µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.23ms | 3.43ms | _load | Module::Load::
1 | 1 | 1 | 17µs | 32µs | _to_file | Module::Load::
1 | 1 | 1 | 10µs | 11µs | BEGIN@5 | Module::Load::
1 | 1 | 1 | 5µs | 12µs | BEGIN@88 | Module::Load::
1 | 1 | 1 | 4µs | 7µs | _is_file | Module::Load::
1 | 1 | 1 | 4µs | 11µs | BEGIN@13 | Module::Load::
1 | 1 | 1 | 4µs | 7µs | BEGIN@6 | Module::Load::
1 | 1 | 1 | 3µs | 3µs | _who | Module::Load::
2 | 1 | 1 | 2µs | 2µs | CORE:match (opcode) | Module::Load::
1 | 1 | 1 | 2µs | 2µs | BEGIN@7 | Module::Load::
1 | 1 | 1 | 2µs | 2µs | load | 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 | 1 | 300ns | $VERSION = '0.32'; | ||
4 | |||||
5 | 2 | 17µs | 2 | 13µs | # spent 11µs (10+1) within Module::Load::BEGIN@5 which was called:
# once (10µs+1µs) by BenchmarkAnything::Storage::Backend::SQL::new at line 5 # spent 11µs making 1 call to Module::Load::BEGIN@5
# spent 2µs making 1 call to strict::import |
6 | 2 | 13µs | 2 | 11µs | # spent 7µs (4+3) within Module::Load::BEGIN@6 which was called:
# once (4µs+3µs) by BenchmarkAnything::Storage::Backend::SQL::new at line 6 # spent 7µs making 1 call to Module::Load::BEGIN@6
# spent 3µs making 1 call to warnings::import |
7 | 2 | 26µs | 1 | 2µs | # spent 2µs within Module::Load::BEGIN@7 which was called:
# once (2µs+0s) by BenchmarkAnything::Storage::Backend::SQL::new at line 7 # spent 2µs making 1 call to Module::Load::BEGIN@7 |
8 | |||||
9 | sub import { | ||||
10 | my $who = _who(); | ||||
11 | my $h; shift; | ||||
12 | |||||
13 | 2 | 255µs | 2 | 17µs | # spent 11µs (4+6) within Module::Load::BEGIN@13 which was called:
# once (4µs+6µs) by BenchmarkAnything::Storage::Backend::SQL::new at line 13 # spent 11µs making 1 call to Module::Load::BEGIN@13
# spent 6µs making 1 call to strict::unimport |
14 | |||||
15 | @_ or ( | ||||
16 | *{"${who}::load"} = \&load, # compat to prev version | ||||
17 | *{"${who}::autoload"} = \&autoload, | ||||
18 | return | ||||
19 | ); | ||||
20 | |||||
21 | map { $h->{$_} = () if defined $_ } @_; | ||||
22 | |||||
23 | (exists $h->{none} or exists $h->{''}) | ||||
24 | and shift, last; | ||||
25 | |||||
26 | ((exists $h->{autoload} and shift,1) or (exists $h->{all} and shift)) | ||||
27 | and *{"${who}::autoload"} = \&autoload; | ||||
28 | |||||
29 | ((exists $h->{load} and shift,1) or exists $h->{all}) | ||||
30 | and *{"${who}::load"} = \&load; | ||||
31 | |||||
32 | ((exists $h->{load_remote} and shift,1) or exists $h->{all}) | ||||
33 | and *{"${who}::load_remote"} = \&load_remote; | ||||
34 | |||||
35 | ((exists $h->{autoload_remote} and shift,1) or exists $h->{all}) | ||||
36 | and *{"${who}::autoload_remote"} = \&autoload_remote; | ||||
37 | |||||
38 | } | ||||
39 | |||||
40 | } | ||||
41 | |||||
42 | # spent 2µs within Module::Load::load which was called:
# once (2µs+0s) by BenchmarkAnything::Storage::Backend::SQL::new at line 146 of BenchmarkAnything/Storage/Backend/SQL.pm | ||||
43 | 1 | 5µs | 1 | 3.43ms | goto &_load; # spent 3.43ms making 1 call to Module::Load::_load |
44 | } | ||||
45 | |||||
46 | sub autoload(*;@){ | ||||
47 | unshift @_, 'autoimport'; | ||||
48 | goto &_load; | ||||
49 | } | ||||
50 | |||||
51 | sub load_remote($$;@){ | ||||
52 | my ($dst, $src, @exp) = @_; | ||||
53 | |||||
54 | eval "package $dst;Module::Load::load('$src', qw/@exp/);"; | ||||
55 | $@ && die "$@"; | ||||
56 | } | ||||
57 | |||||
58 | sub autoload_remote($$;@){ | ||||
59 | my ($dst, $src, @exp) = @_; | ||||
60 | |||||
61 | eval "package $dst;Module::Load::autoload('$src', qw/@exp/);"; | ||||
62 | $@ && die "$@"; | ||||
63 | } | ||||
64 | |||||
65 | # spent 3.43ms (1.23+2.20) within Module::Load::_load which was called:
# once (1.23ms+2.20ms) by BenchmarkAnything::Storage::Backend::SQL::new at line 43 | ||||
66 | 1 | 600ns | my $autoimport = $_[0] eq 'autoimport' and shift; | ||
67 | 1 | 300ns | my $mod = shift or return; | ||
68 | 1 | 1µs | 1 | 3µs | my $who = _who(); # spent 3µs making 1 call to Module::Load::_who |
69 | |||||
70 | 1 | 600ns | 1 | 7µs | if( _is_file( $mod ) ) { # spent 7µs making 1 call to Module::Load::_is_file |
71 | require $mod; | ||||
72 | } else { | ||||
73 | LOAD: { | ||||
74 | 2 | 200ns | my $err; | ||
75 | 1 | 400ns | for my $flag ( qw[1 0] ) { | ||
76 | 1 | 600ns | 1 | 32µs | my $file = _to_file( $mod, $flag); # spent 32µs making 1 call to Module::Load::_to_file |
77 | 2 | 61µs | eval { require $file }; | ||
78 | 1 | 1µs | $@ ? $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 | |||||
88 | 3 | 183µs | 2 | 20µs | # spent 12µs (5+7) within Module::Load::BEGIN@88 which was called:
# once (5µs+7µs) by BenchmarkAnything::Storage::Backend::SQL::new at line 88 # spent 12µs making 1 call to Module::Load::BEGIN@88
# spent 7µs making 1 call to strict::unimport |
89 | 1 | 100ns | my $import; | ||
90 | |||||
91 | 1 | 500ns | ((@_ or $autoimport) and ( | ||
92 | $import = $mod->can('import') | ||||
93 | ) and ( | ||||
94 | unshift(@_, $mod), | ||||
95 | goto &$import, | ||||
96 | return | ||||
97 | ) | ||||
98 | ); | ||||
99 | } | ||||
100 | |||||
101 | } | ||||
102 | |||||
103 | # spent 32µs (17+14) within Module::Load::_to_file which was called:
# once (17µs+14µs) by Module::Load::_load at line 76 | ||||
104 | 1 | 200ns | local $_ = shift; | ||
105 | 1 | 300ns | my $pm = shift || ''; | ||
106 | |||||
107 | ## trailing blanks ignored by default. [rt #69886] | ||||
108 | 1 | 6µs | my @parts = split /::|'/, $_, -1; | ||
109 | ## make sure that we can't hop out of @INC | ||||
110 | 1 | 300ns | shift @parts if @parts && !$parts[0]; | ||
111 | |||||
112 | ### because of [perl #19213], see caveats ### | ||||
113 | 1 | 23µs | 4 | 21µs | my $file = $^O eq 'MSWin32' # spent 14µ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 800ns/call |
114 | ? join "/", @parts | ||||
115 | : File::Spec->catfile( @parts ); | ||||
116 | |||||
117 | 1 | 400ns | $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 | 300ns | $file = VMS::Filespec::unixify($file) if $^O eq 'VMS'; | ||
125 | |||||
126 | 1 | 3µs | return $file; | ||
127 | } | ||||
128 | |||||
129 | 1 | 4µs | # spent 3µs within Module::Load::_who which was called:
# once (3µs+0s) by Module::Load::_load at line 68 | ||
130 | |||||
131 | # spent 7µs (4+2) within Module::Load::_is_file which was called:
# once (4µs+2µs) by Module::Load::_load at line 70 | ||||
132 | 1 | 200ns | local $_ = shift; | ||
133 | 1 | 8µs | 2 | 2µs | return /^\./ ? 1 : # spent 2µs making 2 calls to Module::Load::CORE:match, avg 1µs/call |
134 | /[^\w:']/ ? 1 : | ||||
135 | undef | ||||
136 | } | ||||
137 | |||||
- - | |||||
140 | 1 | 2µs | 1; | ||
141 | |||||
142 | __END__ | ||||
# spent 2µs within Module::Load::CORE:match which was called 2 times, avg 1µs/call:
# 2 times (2µs+0s) by Module::Load::_is_file at line 133, avg 1µs/call |