line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
192534
|
use strict; |
|
13
|
|
|
|
|
20
|
|
|
13
|
|
|
|
|
289
|
|
2
|
13
|
|
|
13
|
|
41
|
use warnings; |
|
13
|
|
|
|
|
16
|
|
|
13
|
|
|
|
|
553
|
|
3
|
|
|
|
|
|
|
package Class::Load::PP; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
6
|
|
|
|
|
|
|
|
7
|
13
|
|
|
13
|
|
4749
|
use Module::Runtime (); |
|
13
|
|
|
|
|
15749
|
|
|
13
|
|
|
|
|
322
|
|
8
|
13
|
|
|
13
|
|
4920
|
use Package::Stash 0.14; |
|
13
|
|
|
|
|
43619
|
|
|
13
|
|
|
|
|
305
|
|
9
|
13
|
|
|
13
|
|
65
|
use Scalar::Util (); |
|
13
|
|
|
|
|
14
|
|
|
13
|
|
|
|
|
218
|
|
10
|
13
|
|
|
13
|
|
41
|
use Try::Tiny; |
|
13
|
|
|
|
|
12
|
|
|
13
|
|
|
|
|
3202
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub is_class_loaded { |
13
|
128
|
|
|
128
|
0
|
1690
|
my $class = shift; |
14
|
128
|
|
|
|
|
87
|
my $options = shift; |
15
|
|
|
|
|
|
|
|
16
|
128
|
|
|
|
|
171
|
my $loaded = _is_class_loaded($class); |
17
|
|
|
|
|
|
|
|
18
|
128
|
100
|
|
|
|
334
|
return $loaded if ! $loaded; |
19
|
53
|
100
|
66
|
|
|
204
|
return $loaded unless $options && $options->{-version}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return try { |
22
|
10
|
|
|
10
|
|
1479
|
$class->VERSION($options->{-version}); |
23
|
2
|
|
|
|
|
4
|
1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
catch { |
26
|
8
|
|
|
8
|
|
95
|
0; |
27
|
10
|
|
|
|
|
47
|
}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _is_class_loaded { |
31
|
128
|
|
|
128
|
|
165
|
my $class = shift; |
32
|
|
|
|
|
|
|
|
33
|
128
|
50
|
|
|
|
197
|
return 0 unless Module::Runtime::is_module_name($class); |
34
|
|
|
|
|
|
|
|
35
|
128
|
|
|
|
|
1560
|
my $stash = Package::Stash->new($class); |
36
|
|
|
|
|
|
|
|
37
|
128
|
100
|
|
|
|
991
|
if ($stash->has_symbol('$VERSION')) { |
38
|
28
|
|
|
|
|
21
|
my $version = ${ $stash->get_symbol('$VERSION') }; |
|
28
|
|
|
|
|
95
|
|
39
|
28
|
100
|
|
|
|
80
|
if (defined $version) { |
40
|
27
|
100
|
|
|
|
81
|
return 1 if ! ref $version; |
41
|
|
|
|
|
|
|
# Sometimes $VERSION ends up as a reference to undef (weird) |
42
|
1
|
50
|
33
|
|
|
10
|
return 1 if ref $version && Scalar::Util::reftype $version eq 'SCALAR' && defined ${$version}; |
|
0
|
|
33
|
|
|
0
|
|
43
|
|
|
|
|
|
|
# a version object |
44
|
1
|
50
|
|
|
|
11
|
return 1 if Scalar::Util::blessed $version; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
101
|
100
|
|
|
|
328
|
if ($stash->has_symbol('@ISA')) { |
49
|
6
|
100
|
|
|
|
7
|
return 1 if @{ $stash->get_symbol('@ISA') }; |
|
6
|
|
|
|
|
68
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# check for any method |
53
|
98
|
100
|
|
|
|
353
|
return 1 if $stash->list_all_symbols('CODE'); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# fail |
56
|
75
|
|
|
|
|
210
|
return 0; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |