line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package true; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
39472
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
288
|
|
4
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
285
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
8007
|
use B::Hooks::OP::Annotation; |
|
9
|
|
|
|
|
7226
|
|
|
9
|
|
|
|
|
253
|
|
7
|
9
|
|
|
9
|
|
7642
|
use B::Hooks::OP::Check; |
|
9
|
|
|
|
|
16164
|
|
|
9
|
|
|
|
|
321
|
|
8
|
9
|
|
|
9
|
|
8337
|
use Devel::StackTrace; |
|
9
|
|
|
|
|
38104
|
|
|
9
|
|
|
|
|
265
|
|
9
|
9
|
|
|
9
|
|
68
|
use XSLoader; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
3893
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
12
|
|
|
|
|
|
|
our %TRUE; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
XSLoader::load(__PACKAGE__, $VERSION); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# XXX CopFILE(&PL_compiling) gives the wrong result here (it works in the OP checker in the XS). |
17
|
|
|
|
|
|
|
# return the full path of the file that's currently being compiled |
18
|
|
|
|
|
|
|
sub ccfile() { |
19
|
56
|
|
|
56
|
0
|
72
|
my ($file, $source, $line); |
20
|
56
|
|
|
|
|
210
|
my $trace = Devel::StackTrace->new; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# find the innermost require frame |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
# for "use Foo::Bar" or "require Foo::Bar", the evaltext contains "Foo/Bar.pm", and |
25
|
|
|
|
|
|
|
# the filename/line refer to the file where the use/require statement appeared. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# work from the innermost frame out |
28
|
56
|
|
|
|
|
10394
|
while (my $frame = $trace->next_frame) { |
29
|
416
|
100
|
|
|
|
35056
|
next unless ($frame->is_require); |
30
|
53
|
|
|
|
|
342
|
my $required = $frame->evaltext; |
31
|
|
|
|
|
|
|
|
32
|
53
|
50
|
|
|
|
370
|
if (defined($file = $INC{$required})) { |
33
|
53
|
|
|
|
|
174
|
$source = $frame->filename; |
34
|
53
|
|
|
|
|
253
|
$line = $frame->line; |
35
|
|
|
|
|
|
|
} else { # shouldn't happen |
36
|
0
|
|
|
|
|
0
|
warn "true: can't find required file ($required) in \%INC"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
53
|
|
|
|
|
205
|
last; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
56
|
50
|
|
|
|
1264
|
return wantarray ? ($file, $source, $line) : $file; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# XXX should add a debug option |
46
|
|
|
|
|
|
|
sub import { |
47
|
48
|
|
|
48
|
|
41081
|
my ($file, $source, $line) = ccfile(); |
48
|
|
|
|
|
|
|
|
49
|
48
|
100
|
100
|
|
|
897
|
if (defined($file) && not($TRUE{$file})) { |
50
|
34
|
|
|
|
|
76
|
$TRUE{$file} = 1; |
51
|
|
|
|
|
|
|
# warn "true: enabling true for $file at $source line $line", $/; |
52
|
34
|
|
|
|
|
2369
|
xs_enter(); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub unimport { |
57
|
8
|
|
|
8
|
|
94
|
my ($file, $source, $line) = ccfile(); |
58
|
|
|
|
|
|
|
|
59
|
8
|
100
|
66
|
|
|
267
|
if (defined($file) && $TRUE{$file}) { |
60
|
|
|
|
|
|
|
# warn "true: disabling true for $file at $source line $line", $/; |
61
|
4
|
|
|
|
|
9
|
delete $TRUE{$file}; |
62
|
4
|
50
|
|
|
|
141
|
xs_leave() unless (%TRUE); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |