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
|
|
16669
|
# So we load it up beforehand to avoid that. |
8
|
|
|
|
|
|
|
BEGIN { require UNIVERSAL } |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package UNIVERSAL; |
11
|
3
|
|
|
3
|
|
155
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
167
|
|
12
|
|
|
|
|
|
|
use strict; |
13
|
3
|
|
|
3
|
|
17
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1276
|
|
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
|
121
|
|
|
121
|
0
|
629667
|
|
72
|
|
|
|
|
|
|
local $Level = 1; |
73
|
121
|
|
|
|
|
155
|
my $return = $module->require or return 0; |
74
|
|
|
|
|
|
|
|
75
|
121
|
50
|
|
|
|
255
|
my($call_package, $call_file, $call_line) = caller; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
eval qq{ |
78
|
121
|
50
|
|
|
|
4835
|
package $call_package; |
79
|
|
|
|
|
|
|
#line $call_line "$call_file" |
80
|
121
|
|
|
|
|
658
|
\$module->import(\@imports); |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
121
|
|
|
|
|
254
|
if( $@ ) { |
84
|
121
|
|
|
|
|
351
|
$UNIVERSAL::require::ERROR = $@; |
85
|
|
|
|
|
|
|
return 0; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
121
|
50
|
|
|
|
296
|
return $return; |
89
|
|
|
|
|
|
|
} |
90
|
121
|
|
|
|
|
3140
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#line 191 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |