line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
216730
|
use strict; |
|
13
|
|
|
|
|
22
|
|
|
13
|
|
|
|
|
423
|
|
2
|
13
|
|
|
13
|
|
50
|
use warnings; |
|
13
|
|
|
|
|
16
|
|
|
13
|
|
|
|
|
575
|
|
3
|
|
|
|
|
|
|
package Class::Load::PP; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
6
|
|
|
|
|
|
|
|
7
|
13
|
|
|
13
|
|
5655
|
use Module::Runtime (); |
|
13
|
|
|
|
|
15920
|
|
|
13
|
|
|
|
|
309
|
|
8
|
13
|
|
|
13
|
|
5872
|
use Package::Stash 0.14; |
|
13
|
|
|
|
|
44790
|
|
|
13
|
|
|
|
|
337
|
|
9
|
13
|
|
|
13
|
|
80
|
use Scalar::Util (); |
|
13
|
|
|
|
|
18
|
|
|
13
|
|
|
|
|
174
|
|
10
|
13
|
|
|
13
|
|
44
|
use Try::Tiny; |
|
13
|
|
|
|
|
20
|
|
|
13
|
|
|
|
|
3486
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub is_class_loaded { |
13
|
128
|
|
|
128
|
0
|
2472
|
my $class = shift; |
14
|
128
|
|
|
|
|
109
|
my $options = shift; |
15
|
|
|
|
|
|
|
|
16
|
128
|
|
|
|
|
203
|
my $loaded = _is_class_loaded($class); |
17
|
|
|
|
|
|
|
|
18
|
128
|
100
|
|
|
|
376
|
return $loaded if ! $loaded; |
19
|
53
|
100
|
66
|
|
|
233
|
return $loaded unless $options && $options->{-version}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return try { |
22
|
10
|
|
|
10
|
|
338
|
$class->VERSION($options->{-version}); |
23
|
2
|
|
|
|
|
7
|
1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
catch { |
26
|
8
|
|
|
8
|
|
90
|
0; |
27
|
10
|
|
|
|
|
53
|
}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _is_class_loaded { |
31
|
128
|
|
|
128
|
|
198
|
my $class = shift; |
32
|
|
|
|
|
|
|
|
33
|
128
|
50
|
|
|
|
220
|
return 0 unless Module::Runtime::is_module_name($class); |
34
|
|
|
|
|
|
|
|
35
|
128
|
|
|
|
|
1870
|
my $stash = Package::Stash->new($class); |
36
|
|
|
|
|
|
|
|
37
|
128
|
100
|
|
|
|
1012
|
if ($stash->has_symbol('$VERSION')) { |
38
|
28
|
|
|
|
|
25
|
my $version = ${ $stash->get_symbol('$VERSION') }; |
|
28
|
|
|
|
|
117
|
|
39
|
28
|
100
|
|
|
|
101
|
if (defined $version) { |
40
|
27
|
100
|
|
|
|
87
|
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
|
|
|
|
6
|
return 1 if Scalar::Util::blessed $version; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
101
|
100
|
|
|
|
366
|
if ($stash->has_symbol('@ISA')) { |
49
|
6
|
100
|
|
|
|
6
|
return 1 if @{ $stash->get_symbol('@ISA') }; |
|
6
|
|
|
|
|
74
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# check for any method |
53
|
98
|
100
|
|
|
|
360
|
return 1 if $stash->list_all_symbols('CODE'); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# fail |
56
|
75
|
|
|
|
|
200
|
return 0; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |