line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Load; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '0.32'; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
10345
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
81
|
|
6
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
61
|
|
7
|
2
|
|
|
2
|
|
13
|
use File::Spec (); |
|
2
|
|
|
|
|
22
|
|
|
2
|
|
|
|
|
432
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
62
|
|
|
62
|
|
75047
|
my $who = _who(); |
11
|
62
|
|
|
|
|
178
|
my $h; shift; |
|
62
|
|
|
|
|
90
|
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
12
|
{ no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1318
|
|
|
62
|
|
|
|
|
104
|
|
14
|
|
|
|
|
|
|
|
15
|
21
|
|
|
|
|
137
|
@_ or ( |
16
|
21
|
|
|
|
|
1226
|
*{"${who}::load"} = \&load, # compat to prev version |
17
|
62
|
100
|
|
|
|
215
|
*{"${who}::autoload"} = \&autoload, |
18
|
|
|
|
|
|
|
return |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
41
|
100
|
|
|
|
90
|
map { $h->{$_} = () if defined $_ } @_; |
|
58
|
|
|
|
|
347
|
|
22
|
|
|
|
|
|
|
|
23
|
41
|
100
|
100
|
|
|
1189
|
(exists $h->{none} or exists $h->{''}) |
24
|
|
|
|
|
|
|
and shift, last; |
25
|
|
|
|
|
|
|
|
26
|
14
|
|
|
|
|
97
|
((exists $h->{autoload} and shift,1) or (exists $h->{all} and shift)) |
27
|
23
|
100
|
66
|
|
|
236
|
and *{"${who}::autoload"} = \&autoload; |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
14
|
|
|
|
|
60
|
((exists $h->{load} and shift,1) or exists $h->{all}) |
30
|
23
|
100
|
66
|
|
|
184
|
and *{"${who}::load"} = \&load; |
|
|
|
100
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
11
|
|
|
|
|
49
|
((exists $h->{load_remote} and shift,1) or exists $h->{all}) |
33
|
23
|
100
|
66
|
|
|
166
|
and *{"${who}::load_remote"} = \&load_remote; |
|
|
|
100
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
11
|
|
|
|
|
669
|
((exists $h->{autoload_remote} and shift,1) or exists $h->{all}) |
36
|
23
|
100
|
66
|
|
|
765
|
and *{"${who}::autoload_remote"} = \&autoload_remote; |
|
|
|
100
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub load(*;@){ |
43
|
25
|
|
|
25
|
1
|
737
|
goto &_load; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub autoload(*;@){ |
47
|
19
|
|
|
19
|
1
|
105
|
unshift @_, 'autoimport'; |
48
|
19
|
|
|
|
|
70
|
goto &_load; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub load_remote($$;@){ |
52
|
9
|
|
|
9
|
1
|
60
|
my ($dst, $src, @exp) = @_; |
53
|
|
|
|
|
|
|
|
54
|
9
|
|
|
|
|
590
|
eval "package $dst;Module::Load::load('$src', qw/@exp/);"; |
55
|
9
|
100
|
|
|
|
324
|
$@ && die "$@"; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub autoload_remote($$;@){ |
59
|
7
|
|
|
7
|
1
|
42
|
my ($dst, $src, @exp) = @_; |
60
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
393
|
eval "package $dst;Module::Load::autoload('$src', qw/@exp/);"; |
62
|
7
|
100
|
|
|
|
199
|
$@ && die "$@"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _load{ |
66
|
44
|
100
|
|
44
|
|
164
|
my $autoimport = $_[0] eq 'autoimport' and shift; |
67
|
44
|
50
|
|
|
|
142
|
my $mod = shift or return; |
68
|
44
|
|
|
|
|
106
|
my $who = _who(); |
69
|
|
|
|
|
|
|
|
70
|
44
|
100
|
|
|
|
173
|
if( _is_file( $mod ) ) { |
71
|
1
|
|
|
|
|
435
|
require $mod; |
72
|
|
|
|
|
|
|
} else { |
73
|
43
|
|
|
|
|
61
|
LOAD: { |
74
|
43
|
|
|
|
|
63
|
my $err; |
75
|
43
|
|
|
|
|
87
|
for my $flag ( qw[1 0] ) { |
76
|
48
|
|
|
|
|
130
|
my $file = _to_file( $mod, $flag); |
77
|
48
|
|
|
|
|
70
|
eval { require $file }; |
|
48
|
|
|
|
|
18804
|
|
78
|
48
|
100
|
|
|
|
193051
|
$@ ? $err .= $@ : last LOAD; |
79
|
|
|
|
|
|
|
} |
80
|
4
|
50
|
|
|
|
51
|
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
|
|
12
|
{ no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
818
|
|
|
40
|
|
|
|
|
85
|
|
89
|
40
|
|
|
|
|
68
|
my $import; |
90
|
|
|
|
|
|
|
|
91
|
40
|
100
|
100
|
|
|
2799
|
((@_ or $autoimport) and ( |
|
|
|
66
|
|
|
|
|
92
|
|
|
|
|
|
|
$import = $mod->can('import') |
93
|
|
|
|
|
|
|
) and ( |
94
|
|
|
|
|
|
|
unshift(@_, $mod), |
95
|
|
|
|
|
|
|
goto &$import, |
96
|
|
|
|
|
|
|
return |
97
|
|
|
|
|
|
|
) |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _to_file{ |
104
|
53
|
|
|
53
|
|
4035
|
local $_ = shift; |
105
|
53
|
|
100
|
|
|
194
|
my $pm = shift || ''; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
## trailing blanks ignored by default. [rt #69886] |
108
|
53
|
|
|
|
|
414
|
my @parts = split /::|'/, $_, -1; |
109
|
|
|
|
|
|
|
## make sure that we can't hop out of @INC |
110
|
53
|
100
|
66
|
|
|
286
|
shift @parts if @parts && !$parts[0]; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
### because of [perl #19213], see caveats ### |
113
|
53
|
50
|
|
|
|
799
|
my $file = $^O eq 'MSWin32' |
114
|
|
|
|
|
|
|
? join "/", @parts |
115
|
|
|
|
|
|
|
: File::Spec->catfile( @parts ); |
116
|
|
|
|
|
|
|
|
117
|
53
|
100
|
|
|
|
167
|
$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
|
|
|
|
144
|
$file = VMS::Filespec::unixify($file) if $^O eq 'VMS'; |
125
|
|
|
|
|
|
|
|
126
|
53
|
|
|
|
|
155
|
return $file; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
106
|
|
|
106
|
|
3222
|
sub _who { (caller(1))[0] } |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub _is_file { |
132
|
44
|
|
|
44
|
|
122
|
local $_ = shift; |
133
|
44
|
100
|
|
|
|
261
|
return /^\./ ? 1 : |
|
|
50
|
|
|
|
|
|
134
|
|
|
|
|
|
|
/[^\w:']/ ? 1 : |
135
|
|
|
|
|
|
|
undef |
136
|
|
|
|
|
|
|
#' silly bbedit.. |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |