line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
package UNIVERSAL::require; |
3
|
|
|
|
|
|
|
$UNIVERSAL::require::VERSION = '0.11'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# We do this because UNIVERSAL.pm uses CORE::require(). We're going |
6
|
|
|
|
|
|
|
# to put our own require() into UNIVERSAL and that makes an ambiguity. |
7
|
3
|
|
|
3
|
|
27318
|
# So we load it up beforehand to avoid that. |
8
|
|
|
|
|
|
|
BEGIN { require UNIVERSAL } |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package UNIVERSAL; |
11
|
3
|
|
|
3
|
|
128
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
100
|
|
12
|
|
|
|
|
|
|
use strict; |
13
|
3
|
|
|
3
|
|
15
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1087
|
|
14
|
|
|
|
|
|
|
use vars qw($Level); |
15
|
|
|
|
|
|
|
$Level = 0; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#line 69 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub require { |
20
|
|
|
|
|
|
|
my($module, $want_version) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$UNIVERSAL::require::ERROR = ''; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
die("UNIVERSAL::require() can only be run as a class method") |
25
|
|
|
|
|
|
|
if ref $module; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
die("UNIVERSAL::require() takes no or one arguments") if @_ > 2; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my($call_package, $call_file, $call_line) = caller($Level); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Load the module. |
32
|
|
|
|
|
|
|
my $file = $module . '.pm'; |
33
|
|
|
|
|
|
|
$file =~ s{::}{/}g; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# For performance reasons, check if its already been loaded. This makes |
36
|
|
|
|
|
|
|
# things about 4 times faster. |
37
|
|
|
|
|
|
|
return 1 if $INC{$file}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $return = eval qq{ |
40
|
|
|
|
|
|
|
#line $call_line "$call_file" |
41
|
|
|
|
|
|
|
CORE::require(\$file); |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Check for module load failure. |
45
|
|
|
|
|
|
|
if( $@ ) { |
46
|
|
|
|
|
|
|
$UNIVERSAL::require::ERROR = $@; |
47
|
|
|
|
|
|
|
return $return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Module version check. |
51
|
|
|
|
|
|
|
if( @_ == 2 ) { |
52
|
|
|
|
|
|
|
eval qq{ |
53
|
|
|
|
|
|
|
#line $call_line "$call_file" |
54
|
|
|
|
|
|
|
\$module->VERSION($want_version); |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
if( $@ ) { |
58
|
|
|
|
|
|
|
$UNIVERSAL::require::ERROR = $@; |
59
|
|
|
|
|
|
|
return 0; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return $return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#line 136 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub use { |
70
|
|
|
|
|
|
|
my($module, @imports) = @_; |
71
|
131
|
|
|
131
|
0
|
64852
|
|
72
|
|
|
|
|
|
|
local $Level = 1; |
73
|
131
|
|
|
|
|
159
|
my $return = $module->require or return 0; |
74
|
|
|
|
|
|
|
|
75
|
131
|
50
|
|
|
|
266
|
my($call_package, $call_file, $call_line) = caller; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
eval qq{ |
78
|
131
|
50
|
|
|
|
261
|
package $call_package; |
79
|
|
|
|
|
|
|
#line $call_line "$call_file" |
80
|
131
|
|
|
|
|
695
|
\$module->import(\@imports); |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
131
|
|
|
|
|
272
|
if( $@ ) { |
84
|
131
|
|
|
|
|
414
|
$UNIVERSAL::require::ERROR = $@; |
85
|
|
|
|
|
|
|
return 0; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
131
|
100
|
|
|
|
346
|
return $return; |
89
|
|
|
|
|
|
|
} |
90
|
121
|
|
|
|
|
3278
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#line 191 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |