line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Plugin::INC_Jail; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
12084
|
use 5.008001; |
|
7
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
38
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
148
|
|
6
|
7
|
|
|
7
|
|
32
|
use warnings; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
200
|
|
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
38
|
use Carp; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
2715
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.007'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
13
|
7
|
|
|
7
|
|
69
|
my ( undef, $test_class, @test_inc ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
7
|
|
|
|
|
19
|
my $caller = caller; |
16
|
|
|
|
|
|
|
|
17
|
7
|
100
|
|
|
|
27
|
unless ( defined $test_class ) { |
18
|
6
|
50
|
|
|
|
87
|
my $code = $caller->can( 'CLASS' ) |
19
|
|
|
|
|
|
|
or croak 'No test class specified and caller does not define CLASS'; |
20
|
6
|
|
|
|
|
21
|
$test_class = $code->(); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
@test_inc |
24
|
7
|
50
|
|
|
|
25
|
or push @test_inc, 't/lib'; |
25
|
7
|
|
|
|
|
18
|
foreach ( @test_inc ) { |
26
|
|
|
|
|
|
|
-d |
27
|
7
|
50
|
|
|
|
156
|
or croak "Test module directory $_ not found"; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
unshift @INC, sub { |
31
|
|
|
|
|
|
|
|
32
|
160
|
|
|
160
|
|
898182
|
my $lvl = 0; |
33
|
|
|
|
|
|
|
|
34
|
160
|
|
|
|
|
640
|
while ( my $pkg = caller $lvl ) { |
35
|
|
|
|
|
|
|
|
36
|
261
|
100
|
|
|
|
551
|
if ( $test_class eq $pkg ) { |
37
|
19
|
|
|
|
|
55
|
foreach my $dir ( @test_inc ) { |
38
|
19
|
|
|
|
|
38
|
my $fh; |
39
|
19
|
50
|
|
|
|
4932
|
open $fh, '<', "$dir/$_[1]" |
|
|
100
|
|
|
|
|
|
40
|
|
|
|
|
|
|
and return $] ge '5.020' ? ( \'', $fh ) : $fh; |
41
|
|
|
|
|
|
|
} |
42
|
9
|
|
|
|
|
1740
|
croak "Can't locate $_[1] in \@INC"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# The reason we have to iterate if the package is our |
46
|
|
|
|
|
|
|
# original caller is that the module under test might be |
47
|
|
|
|
|
|
|
# loading the requested module on behalf of said caller by |
48
|
|
|
|
|
|
|
# doing a stringy eval in the caller's name space. |
49
|
242
|
100
|
|
|
|
65304
|
$caller eq $pkg |
50
|
|
|
|
|
|
|
or return; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} continue { |
53
|
109
|
|
|
|
|
271
|
$lvl++; |
54
|
|
|
|
|
|
|
} |
55
|
8
|
|
|
|
|
3199
|
return; |
56
|
7
|
|
|
|
|
50
|
}; |
57
|
|
|
|
|
|
|
|
58
|
7
|
|
|
|
|
202
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |