| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Load; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '0.34'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
3006
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
46
|
|
|
6
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
36
|
|
|
7
|
2
|
|
|
2
|
|
8
|
use File::Spec (); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
72
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
|
10
|
62
|
|
|
62
|
|
60682
|
my $who = _who(); |
|
11
|
62
|
|
|
|
|
104
|
my $h; shift; |
|
|
62
|
|
|
|
|
67
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
9
|
{ no strict 'refs'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1025
|
|
|
|
62
|
|
|
|
|
93
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
@_ or ( |
|
16
|
21
|
|
|
|
|
97
|
*{"${who}::load"} = \&load, # compat to prev version |
|
17
|
62
|
100
|
|
|
|
143
|
*{"${who}::autoload"} = \&autoload, |
|
|
21
|
|
|
|
|
825
|
|
|
18
|
|
|
|
|
|
|
return |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
41
|
100
|
|
|
|
74
|
map { $h->{$_} = () if defined $_ } @_; |
|
|
58
|
|
|
|
|
230
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
41
|
100
|
100
|
|
|
802
|
(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
|
23
|
100
|
66
|
|
|
114
|
and *{"${who}::autoload"} = \&autoload; |
|
|
14
|
|
66
|
|
|
63
|
|
|
|
|
|
100
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
((exists $h->{load} and shift,1) or exists $h->{all}) |
|
30
|
23
|
100
|
66
|
|
|
102
|
and *{"${who}::load"} = \&load; |
|
|
14
|
|
100
|
|
|
42
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
((exists $h->{load_remote} and shift,1) or exists $h->{all}) |
|
33
|
23
|
100
|
66
|
|
|
93
|
and *{"${who}::load_remote"} = \&load_remote; |
|
|
11
|
|
100
|
|
|
34
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
((exists $h->{autoload_remote} and shift,1) or exists $h->{all}) |
|
36
|
23
|
100
|
66
|
|
|
535
|
and *{"${who}::autoload_remote"} = \&autoload_remote; |
|
|
11
|
|
100
|
|
|
490
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub load(*;@){ |
|
43
|
25
|
|
|
25
|
1
|
852
|
goto &_load; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub autoload(*;@){ |
|
47
|
19
|
|
|
19
|
1
|
85
|
unshift @_, 'autoimport'; |
|
48
|
19
|
|
|
|
|
49
|
goto &_load; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub load_remote($$;@){ |
|
52
|
9
|
|
|
9
|
1
|
60
|
my ($dst, $src, @exp) = @_; |
|
53
|
|
|
|
|
|
|
|
|
54
|
9
|
|
|
|
|
435
|
eval "package $dst;Module::Load::load('$src', qw/@exp/);"; |
|
55
|
9
|
100
|
|
|
|
177
|
$@ && die "$@"; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub autoload_remote($$;@){ |
|
59
|
7
|
|
|
7
|
1
|
43
|
my ($dst, $src, @exp) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
309
|
eval "package $dst;Module::Load::autoload('$src', qw/@exp/);"; |
|
62
|
7
|
100
|
|
|
|
135
|
$@ && die "$@"; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _load{ |
|
66
|
44
|
100
|
|
44
|
|
125
|
my $autoimport = $_[0] eq 'autoimport' and shift; |
|
67
|
44
|
50
|
|
|
|
86
|
my $mod = shift or return; |
|
68
|
44
|
|
|
|
|
72
|
my $who = _who(); |
|
69
|
|
|
|
|
|
|
|
|
70
|
44
|
100
|
|
|
|
85
|
if( _is_file( $mod ) ) { |
|
71
|
1
|
|
|
|
|
188
|
require $mod; |
|
72
|
|
|
|
|
|
|
} else { |
|
73
|
|
|
|
|
|
|
LOAD: { |
|
74
|
43
|
|
|
|
|
49
|
my $err; |
|
|
43
|
|
|
|
|
45
|
|
|
75
|
43
|
|
|
|
|
102
|
for my $flag ( qw[1 0] ) { |
|
76
|
48
|
|
|
|
|
72
|
my $file = _to_file( $mod, $flag); |
|
77
|
48
|
|
|
|
|
65
|
eval { require $file }; |
|
|
48
|
|
|
|
|
6668
|
|
|
78
|
48
|
100
|
|
|
|
113488
|
$@ ? $err .= $@ : last LOAD; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
4
|
50
|
|
|
|
45
|
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
|
2
|
|
|
2
|
|
16
|
{ no strict 'refs'; |
|
|
2
|
|
|
|
|
9
|
|
|
|
2
|
|
|
|
|
609
|
|
|
|
40
|
|
|
|
|
73
|
|
|
89
|
40
|
|
|
|
|
53
|
my $import; |
|
90
|
|
|
|
|
|
|
|
|
91
|
40
|
100
|
100
|
|
|
1353
|
((@_ or $autoimport) and ( |
|
|
|
|
66
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$import = $mod->can('import') |
|
93
|
|
|
|
|
|
|
) and ( |
|
94
|
|
|
|
|
|
|
unshift(@_, $mod), |
|
95
|
|
|
|
|
|
|
goto &$import |
|
96
|
|
|
|
|
|
|
) |
|
97
|
|
|
|
|
|
|
); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _to_file{ |
|
103
|
53
|
|
|
53
|
|
3209
|
local $_ = shift; |
|
104
|
53
|
|
100
|
|
|
115
|
my $pm = shift || ''; |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
## trailing blanks ignored by default. [rt #69886] |
|
107
|
53
|
|
|
|
|
254
|
my @parts = split /::|'/, $_, -1; |
|
108
|
|
|
|
|
|
|
## make sure that we can't hop out of @INC |
|
109
|
53
|
100
|
66
|
|
|
189
|
shift @parts if @parts && !$parts[0]; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
### because of [perl #19213], see caveats ### |
|
112
|
53
|
50
|
|
|
|
445
|
my $file = $^O eq 'MSWin32' |
|
113
|
|
|
|
|
|
|
? join "/", @parts |
|
114
|
|
|
|
|
|
|
: File::Spec->catfile( @parts ); |
|
115
|
|
|
|
|
|
|
|
|
116
|
53
|
100
|
|
|
|
133
|
$file .= '.pm' if $pm; |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
### on perl's before 5.10 (5.9.5@31746) if you require |
|
119
|
|
|
|
|
|
|
### a file in VMS format, it's stored in %INC in VMS |
|
120
|
|
|
|
|
|
|
### format. Therefor, better unixify it first |
|
121
|
|
|
|
|
|
|
### Patch in reply to John Malmbergs patch (as mentioned |
|
122
|
|
|
|
|
|
|
### above) on p5p Tue 21 Aug 2007 04:55:07 |
|
123
|
53
|
50
|
|
|
|
108
|
$file = VMS::Filespec::unixify($file) if $^O eq 'VMS'; |
|
124
|
|
|
|
|
|
|
|
|
125
|
53
|
|
|
|
|
115
|
return $file; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
106
|
|
|
106
|
|
579
|
sub _who { (caller(1))[0] } |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub _is_file { |
|
131
|
44
|
|
|
44
|
|
66
|
local $_ = shift; |
|
132
|
44
|
100
|
|
|
|
174
|
return /^\./ ? 1 : |
|
|
|
50
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
/[^\w:']/ ? 1 : |
|
134
|
|
|
|
|
|
|
undef |
|
135
|
|
|
|
|
|
|
#' silly bbedit.. |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
__END__ |