line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package first; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23889
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
85
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
810
|
use version;our $VERSION = qv('0.0.1'); |
|
1
|
|
|
|
|
2390
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# require UNIVERSAL::require; |
10
|
|
|
|
|
|
|
# until http://rt.cpan.org/Ticket/Display.html?id=24741 is added we'll inlcude it at the end |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $module; |
13
|
|
|
|
|
|
|
our $failed = {}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
16
|
1
|
|
|
1
|
|
9
|
my $self = shift; |
17
|
1
|
|
|
|
|
2
|
my %flags = map { $_ => 1,} grep(/^-/, @_); |
|
0
|
|
|
|
|
0
|
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
2
|
$module = undef; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
4
|
local $UNIVERSAL::Level = $UNIVERSAL::Level + 1; # || -level=1 + 1 |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
3
|
for my $ns (grep !/^-/, @_) { |
24
|
0
|
0
|
|
|
|
0
|
next if !defined$ns; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
0
|
my $nms = $ns; # copy to possibly modify |
27
|
0
|
|
|
|
|
0
|
my @imp; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
0
|
if(ref $ns eq 'ARRAY') { |
30
|
0
|
|
|
|
|
0
|
$nms = shift @{ $ns }; |
|
0
|
|
|
|
|
0
|
|
31
|
0
|
|
|
|
|
0
|
@imp = @{ $ns }; |
|
0
|
|
|
|
|
0
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
0
|
if( @imp ? $nms->use( @imp ) : $nms->use ) { |
|
|
0
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
$module = $nms; |
36
|
0
|
|
|
|
|
0
|
last; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
0
|
|
|
|
|
0
|
$failed->{ $nms } = $@; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
1
|
50
|
|
|
|
2
|
if( keys %{ $failed } ) { |
|
1
|
|
|
|
|
7
|
|
44
|
0
|
|
|
|
|
0
|
my $msg = "Could not load these modules:\n\t" . join("\n\t", keys %{ $failed }) . "\n"; |
|
0
|
|
|
|
|
0
|
|
45
|
0
|
0
|
|
|
|
0
|
carp $msg if exists $flags{'-carp'}; |
46
|
0
|
0
|
|
|
|
0
|
croak $msg if exists $flags{'-croak'}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
10
|
return $module; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
################################ |
53
|
|
|
|
|
|
|
#### start UNIVERSAL::require ## |
54
|
|
|
|
|
|
|
################################ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# UNIVERSAL-require-0.11 |
57
|
|
|
|
|
|
|
# sans POD, and with http://rt.cpan.org/Ticket/Display.html?id=24741 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
package UNIVERSAL::require; |
60
|
|
|
|
|
|
|
$UNIVERSAL::require::VERSION = '0.11'; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# We do this because UNIVERSAL.pm uses CORE::require(). We're going |
63
|
|
|
|
|
|
|
# to put our own require() into UNIVERSAL and that makes an ambiguity. |
64
|
|
|
|
|
|
|
# So we load it up beforehand to avoid that. |
65
|
1
|
|
|
1
|
|
1359
|
BEGIN { require UNIVERSAL } |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
package UNIVERSAL; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
1
|
|
42
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
1
|
|
6
|
use vars qw($Level); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
590
|
|
72
|
|
|
|
|
|
|
$Level = 0; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub require { |
75
|
0
|
|
|
0
|
0
|
|
my($module, $want_version) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$UNIVERSAL::require::ERROR = ''; |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
die("UNIVERSAL::require() can only be run as a class method") |
80
|
|
|
|
|
|
|
if ref $module; |
81
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
die("UNIVERSAL::require() takes no or one arguments") if @_ > 2; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my($call_package, $call_file, $call_line) = caller($Level); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Load the module. |
87
|
0
|
|
|
|
|
|
my $file = $module . '.pm'; |
88
|
0
|
|
|
|
|
|
$file =~ s{::}{/}g; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# For performance reasons, check if its already been loaded. This makes |
91
|
|
|
|
|
|
|
# things about 4 times faster. |
92
|
0
|
0
|
|
|
|
|
return 1 if $INC{$file}; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $return = eval qq{ |
95
|
|
|
|
|
|
|
#line $call_line "$call_file" |
96
|
|
|
|
|
|
|
CORE::require(\$file); |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Check for module load failure. |
100
|
0
|
0
|
|
|
|
|
if( $@ ) { |
101
|
0
|
|
|
|
|
|
$UNIVERSAL::require::ERROR = $@; |
102
|
0
|
|
|
|
|
|
return $return; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Module version check. |
106
|
0
|
0
|
|
|
|
|
if( @_ == 2 ) { |
107
|
0
|
|
|
|
|
|
eval qq{ |
108
|
|
|
|
|
|
|
#line $call_line "$call_file" |
109
|
|
|
|
|
|
|
\$module->VERSION($want_version); |
110
|
|
|
|
|
|
|
}; |
111
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
if( $@ ) { |
113
|
0
|
|
|
|
|
|
$UNIVERSAL::require::ERROR = $@; |
114
|
0
|
|
|
|
|
|
return 0; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
return $return; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub use { |
122
|
0
|
|
|
0
|
0
|
|
my($module, @imports) = @_; |
123
|
|
|
|
|
|
|
|
124
|
0
|
0
|
|
|
|
|
local $Level = $Level ? $Level : 1; |
125
|
0
|
0
|
|
|
|
|
my $return = $module->require or return 0; |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my($call_package, $call_file, $call_line) = caller; |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
eval qq{ |
130
|
|
|
|
|
|
|
package $call_package; |
131
|
|
|
|
|
|
|
#line $call_line "$call_file" |
132
|
|
|
|
|
|
|
\$module->import(\@imports); |
133
|
|
|
|
|
|
|
}; |
134
|
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
|
if( $@ ) { |
136
|
0
|
|
|
|
|
|
$UNIVERSAL::require::ERROR = $@; |
137
|
0
|
|
|
|
|
|
return 0; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return $return; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
############################## |
144
|
|
|
|
|
|
|
#### end UNIVERSAL::require ## |
145
|
|
|
|
|
|
|
############################## |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
__END__ |