line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::NoLoad; |
2
|
1
|
|
|
1
|
|
35058
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use Test::More qw//; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
834
|
|
9
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
10
|
|
|
|
|
|
|
our @EXPORT = qw/check_no_load load_ok/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub check_no_load { |
13
|
1
|
|
|
1
|
1
|
341
|
my @list = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
2
|
for my $element (@list) { |
16
|
2
|
100
|
|
|
|
239
|
Test::More::ok( |
17
|
|
|
|
|
|
|
ref($element) eq 'Regexp' ? !_match($element) : !_loaded($element), |
18
|
|
|
|
|
|
|
"no_load: $element", |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _match { |
24
|
1
|
|
|
1
|
|
2
|
my $regexp = shift; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
2
|
my $match; |
27
|
1
|
|
|
|
|
33
|
for my $module (keys %INC) { |
28
|
71
|
|
|
|
|
109
|
$module = _path2class($module); |
29
|
71
|
50
|
|
|
|
270
|
if ($module =~ m!$regexp!) { |
30
|
0
|
|
|
|
|
0
|
Test::More::note("$module was loaded"); |
31
|
0
|
|
|
|
|
0
|
$match = 1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
1
|
|
|
|
|
11
|
return $match; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _loaded { |
38
|
2
|
|
|
2
|
|
5
|
my $module = shift; |
39
|
2
|
|
|
|
|
6
|
$module =~ s!::!/!g; |
40
|
2
|
100
|
|
|
|
17
|
if ( defined( $INC{"$module\.pm"} ) ) { |
41
|
1
|
|
|
|
|
7
|
Test::More::note("$module was loaded"); |
42
|
1
|
|
|
|
|
126
|
return 1; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub load_ok { |
47
|
1
|
|
|
1
|
1
|
9
|
my @modules = @_; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
3
|
for my $module (@modules) { |
50
|
1
|
|
|
|
|
5
|
Test::More::ok( _loaded($module), "load ok: $module" ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub dump_modules { |
56
|
1
|
|
|
1
|
1
|
3617
|
my $msg = '---[loaded modules]-----'; |
57
|
1
|
|
|
|
|
4
|
Test::More::note($msg); |
58
|
1
|
|
|
|
|
187
|
for my $module (sort keys %INC) { |
59
|
67
|
|
|
|
|
2869
|
Test::More::note( _path2class($module) ); |
60
|
|
|
|
|
|
|
} |
61
|
1
|
|
|
|
|
56
|
Test::More::note( '-' x length($msg) ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _path2class { |
65
|
138
|
|
|
138
|
|
172
|
my $module = shift; |
66
|
138
|
|
|
|
|
295
|
$module =~ s!/!::!g; |
67
|
138
|
|
|
|
|
370
|
$module =~ s!\.pm$!!; |
68
|
138
|
|
|
|
|
351
|
return $module; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |