line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
707871
|
use strict; |
|
13
|
|
|
|
|
106
|
|
|
13
|
|
|
|
|
284
|
|
2
|
13
|
|
|
13
|
|
51
|
use warnings; |
|
13
|
|
|
|
|
18
|
|
|
13
|
|
|
|
|
534
|
|
3
|
|
|
|
|
|
|
package Class::Load::PP; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.25'; |
6
|
|
|
|
|
|
|
|
7
|
13
|
|
|
13
|
|
5036
|
use Module::Runtime (); |
|
13
|
|
|
|
|
17189
|
|
|
13
|
|
|
|
|
318
|
|
8
|
13
|
|
|
13
|
|
4815
|
use Package::Stash 0.14; |
|
13
|
|
|
|
|
46560
|
|
|
13
|
|
|
|
|
297
|
|
9
|
13
|
|
|
13
|
|
89
|
use Scalar::Util (); |
|
13
|
|
|
|
|
19
|
|
|
13
|
|
|
|
|
210
|
|
10
|
13
|
|
|
13
|
|
49
|
use Try::Tiny; |
|
13
|
|
|
|
|
19
|
|
|
13
|
|
|
|
|
3358
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub is_class_loaded { |
13
|
128
|
|
|
128
|
0
|
2515
|
my $class = shift; |
14
|
128
|
|
|
|
|
157
|
my $options = shift; |
15
|
|
|
|
|
|
|
|
16
|
128
|
|
|
|
|
208
|
my $loaded = _is_class_loaded($class); |
17
|
|
|
|
|
|
|
|
18
|
128
|
100
|
|
|
|
351
|
return $loaded if ! $loaded; |
19
|
53
|
100
|
66
|
|
|
202
|
return $loaded unless $options && $options->{-version}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return try { |
22
|
10
|
|
|
10
|
|
470
|
$class->VERSION($options->{-version}); |
23
|
2
|
|
|
|
|
6
|
1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
catch { |
26
|
8
|
|
|
8
|
|
118
|
0; |
27
|
10
|
|
|
|
|
48
|
}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _is_class_loaded { |
31
|
128
|
|
|
128
|
|
146
|
my $class = shift; |
32
|
|
|
|
|
|
|
|
33
|
128
|
50
|
|
|
|
204
|
return 0 unless Module::Runtime::is_module_name($class); |
34
|
|
|
|
|
|
|
|
35
|
128
|
|
|
|
|
1742
|
my $stash = Package::Stash->new($class); |
36
|
|
|
|
|
|
|
|
37
|
128
|
100
|
|
|
|
987
|
if ($stash->has_symbol('$VERSION')) { |
38
|
28
|
|
|
|
|
40
|
my $version = ${ $stash->get_symbol('$VERSION') }; |
|
28
|
|
|
|
|
109
|
|
39
|
28
|
100
|
|
|
|
57
|
if (defined $version) { |
40
|
27
|
100
|
|
|
|
88
|
return 1 if ! ref $version; |
41
|
|
|
|
|
|
|
# Sometimes $VERSION ends up as a reference to undef (weird) |
42
|
1
|
50
|
33
|
|
|
19
|
return 1 if ref $version && Scalar::Util::reftype $version eq 'SCALAR' && defined ${$version}; |
|
0
|
|
33
|
|
|
0
|
|
43
|
|
|
|
|
|
|
# a version object |
44
|
1
|
50
|
|
|
|
6
|
return 1 if Scalar::Util::blessed $version; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
101
|
100
|
|
|
|
377
|
if ($stash->has_symbol('@ISA')) { |
49
|
6
|
100
|
|
|
|
8
|
return 1 if @{ $stash->get_symbol('@ISA') }; |
|
6
|
|
|
|
|
39
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# check for any method |
53
|
98
|
100
|
|
|
|
369
|
return 1 if $stash->list_all_symbols('CODE'); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# fail |
56
|
75
|
|
|
|
|
199
|
return 0; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |