line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Plugin::INC_Jail; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
9135
|
use 5.008001; |
|
7
|
|
|
|
|
21
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
32
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
111
|
|
6
|
7
|
|
|
7
|
|
25
|
use warnings; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
142
|
|
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
27
|
use Carp; |
|
7
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
2061
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.008'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
13
|
7
|
|
|
7
|
|
56
|
my ( undef, $test_class, @test_inc ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
7
|
|
|
|
|
13
|
my $caller = caller; |
16
|
|
|
|
|
|
|
|
17
|
7
|
100
|
|
|
|
20
|
unless ( defined $test_class ) { |
18
|
6
|
50
|
|
|
|
58
|
my $code = $caller->can( 'CLASS' ) |
19
|
|
|
|
|
|
|
or croak 'No test class specified and caller does not define CLASS'; |
20
|
6
|
|
|
|
|
14
|
$test_class = $code->(); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
@test_inc |
24
|
7
|
50
|
|
|
|
19
|
or push @test_inc, 't/lib'; |
25
|
7
|
|
|
|
|
13
|
foreach ( @test_inc ) { |
26
|
|
|
|
|
|
|
-d |
27
|
7
|
50
|
|
|
|
142
|
or croak "Test module directory $_ not found"; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
unshift @INC, sub { |
31
|
|
|
|
|
|
|
|
32
|
160
|
|
|
160
|
|
705556
|
my $lvl = 0; |
33
|
|
|
|
|
|
|
|
34
|
160
|
|
|
|
|
446
|
while ( my $pkg = caller $lvl ) { |
35
|
|
|
|
|
|
|
|
36
|
261
|
100
|
|
|
|
413
|
if ( $test_class eq $pkg ) { |
37
|
19
|
|
|
|
|
36
|
foreach my $dir ( @test_inc ) { |
38
|
19
|
|
|
|
|
23
|
my $fh; |
39
|
19
|
50
|
|
|
|
2963
|
open $fh, '<', "$dir/$_[1]" |
|
|
100
|
|
|
|
|
|
40
|
|
|
|
|
|
|
and return $] ge '5.020' ? ( \'', $fh ) : $fh; |
41
|
|
|
|
|
|
|
} |
42
|
9
|
|
|
|
|
1247
|
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
|
|
|
|
50762
|
$caller eq $pkg |
50
|
|
|
|
|
|
|
or return; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} continue { |
53
|
109
|
|
|
|
|
170
|
$lvl++; |
54
|
|
|
|
|
|
|
} |
55
|
8
|
|
|
|
|
2487
|
return; |
56
|
7
|
|
|
|
|
39
|
}; |
57
|
|
|
|
|
|
|
|
58
|
7
|
|
|
|
|
166
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |