| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Load; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
3884
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
62
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
69
|
|
|
5
|
2
|
|
|
2
|
|
19
|
use File::Spec (); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
116
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.36'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import { |
|
11
|
62
|
|
|
62
|
|
72660
|
my $who = _who(); |
|
12
|
62
|
|
|
|
|
122
|
my $h; shift; |
|
|
62
|
|
|
|
|
84
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
12
|
{ no strict 'refs'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1367
|
|
|
|
62
|
|
|
|
|
85
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
@_ or ( |
|
17
|
21
|
|
|
|
|
102
|
*{"${who}::load"} = \&load, # compat to prev version |
|
18
|
62
|
100
|
|
|
|
178
|
*{"${who}::autoload"} = \&autoload, |
|
|
21
|
|
|
|
|
1028
|
|
|
19
|
|
|
|
|
|
|
return |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
41
|
100
|
|
|
|
81
|
map { $h->{$_} = () if defined $_ } @_; |
|
|
58
|
|
|
|
|
273
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
41
|
100
|
100
|
|
|
956
|
(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
|
23
|
100
|
66
|
|
|
129
|
and *{"${who}::autoload"} = \&autoload; |
|
|
14
|
|
66
|
|
|
63
|
|
|
|
|
|
100
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
((exists $h->{load} and shift,1) or exists $h->{all}) |
|
31
|
23
|
100
|
66
|
|
|
107
|
and *{"${who}::load"} = \&load; |
|
|
14
|
|
100
|
|
|
45
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
((exists $h->{load_remote} and shift,1) or exists $h->{all}) |
|
34
|
23
|
100
|
66
|
|
|
106
|
and *{"${who}::load_remote"} = \&load_remote; |
|
|
11
|
|
100
|
|
|
40
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
((exists $h->{autoload_remote} and shift,1) or exists $h->{all}) |
|
37
|
23
|
100
|
66
|
|
|
646
|
and *{"${who}::autoload_remote"} = \&autoload_remote; |
|
|
11
|
|
100
|
|
|
554
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub load(*;@){ |
|
44
|
25
|
|
|
25
|
1
|
1006
|
goto &_load; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub autoload(*;@){ |
|
48
|
19
|
|
|
19
|
1
|
101
|
unshift @_, 'autoimport'; |
|
49
|
19
|
|
|
|
|
68
|
goto &_load; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub load_remote($$;@){ |
|
53
|
9
|
|
|
9
|
1
|
66
|
my ($dst, $src, @exp) = @_; |
|
54
|
|
|
|
|
|
|
|
|
55
|
9
|
|
|
|
|
494
|
eval "package $dst;Module::Load::load('$src', qw/@exp/);"; |
|
56
|
9
|
100
|
|
|
|
196
|
$@ && die "$@"; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub autoload_remote($$;@){ |
|
60
|
7
|
|
|
7
|
1
|
49
|
my ($dst, $src, @exp) = @_; |
|
61
|
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
366
|
eval "package $dst;Module::Load::autoload('$src', qw/@exp/);"; |
|
63
|
7
|
100
|
|
|
|
148
|
$@ && die "$@"; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub _load{ |
|
67
|
44
|
100
|
|
44
|
|
148
|
my $autoimport = $_[0] eq 'autoimport' and shift; |
|
68
|
44
|
50
|
|
|
|
138
|
my $mod = shift or return; |
|
69
|
44
|
|
|
|
|
84
|
my $who = _who(); |
|
70
|
|
|
|
|
|
|
|
|
71
|
44
|
100
|
|
|
|
91
|
if( _is_file( $mod ) ) { |
|
72
|
1
|
|
|
|
|
219
|
require $mod; |
|
73
|
|
|
|
|
|
|
} else { |
|
74
|
|
|
|
|
|
|
LOAD: { |
|
75
|
43
|
|
|
|
|
56
|
my $err; |
|
|
43
|
|
|
|
|
50
|
|
|
76
|
43
|
|
|
|
|
99
|
for my $flag ( qw[1 0] ) { |
|
77
|
48
|
|
|
|
|
92
|
my $file = _to_file( $mod, $flag); |
|
78
|
48
|
|
|
|
|
80
|
eval { require $file }; |
|
|
48
|
|
|
|
|
8419
|
|
|
79
|
48
|
100
|
|
|
|
138977
|
$@ ? $err .= $@ : last LOAD; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
4
|
50
|
|
|
|
51
|
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
|
2
|
|
|
2
|
|
25
|
{ no strict 'refs'; |
|
|
2
|
|
|
|
|
13
|
|
|
|
2
|
|
|
|
|
786
|
|
|
|
40
|
|
|
|
|
81
|
|
|
90
|
40
|
|
|
|
|
51
|
my $import; |
|
91
|
|
|
|
|
|
|
|
|
92
|
40
|
100
|
100
|
|
|
1597
|
((@_ or $autoimport) and ( |
|
|
|
|
66
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$import = $mod->can('import') |
|
94
|
|
|
|
|
|
|
) and ( |
|
95
|
|
|
|
|
|
|
unshift(@_, $mod), |
|
96
|
|
|
|
|
|
|
goto &$import |
|
97
|
|
|
|
|
|
|
) |
|
98
|
|
|
|
|
|
|
); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _to_file{ |
|
104
|
53
|
|
|
53
|
|
4018
|
local $_ = shift; |
|
105
|
53
|
|
100
|
|
|
132
|
my $pm = shift || ''; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
## trailing blanks ignored by default. [rt #69886] |
|
108
|
53
|
|
|
|
|
284
|
my @parts = split /::|'/, $_, -1; |
|
109
|
|
|
|
|
|
|
## make sure that we can't hop out of @INC |
|
110
|
53
|
100
|
66
|
|
|
222
|
shift @parts if @parts && !$parts[0]; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
### because of [perl #19213], see caveats ### |
|
113
|
53
|
50
|
|
|
|
519
|
my $file = $^O eq 'MSWin32' |
|
114
|
|
|
|
|
|
|
? join "/", @parts |
|
115
|
|
|
|
|
|
|
: File::Spec->catfile( @parts ); |
|
116
|
|
|
|
|
|
|
|
|
117
|
53
|
100
|
|
|
|
151
|
$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
|
53
|
50
|
|
|
|
112
|
$file = VMS::Filespec::unixify($file) if $^O eq 'VMS'; |
|
125
|
|
|
|
|
|
|
|
|
126
|
53
|
|
|
|
|
128
|
return $file; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
106
|
|
|
106
|
|
711
|
sub _who { (caller(1))[0] } |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub _is_file { |
|
132
|
44
|
|
|
44
|
|
71
|
local $_ = shift; |
|
133
|
44
|
100
|
|
|
|
214
|
return /^\./ ? 1 : |
|
|
|
50
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
/[^\w:']/ ? 1 : |
|
135
|
|
|
|
|
|
|
undef |
|
136
|
|
|
|
|
|
|
#' silly bbedit.. |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |