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