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