line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package B::OPCheck; # git description: v0.31-4-gd081d88 |
2
|
|
|
|
|
|
|
# ABSTRACT: PL_check hacks using Perl callbacks |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
13243
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
65
|
|
10
|
1
|
|
|
1
|
|
4
|
use XSLoader; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
13
|
|
11
|
1
|
|
|
1
|
|
3
|
use Scalar::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
12
|
1
|
|
|
1
|
|
359
|
use Scope::Guard; |
|
1
|
|
|
|
|
319
|
|
|
1
|
|
|
|
|
59
|
|
13
|
1
|
|
|
1
|
|
511
|
use B::Utils 0.08 (); |
|
1
|
|
|
|
|
3933
|
|
|
1
|
|
|
|
|
158
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.32'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
XSLoader::load 'B::OPCheck', $VERSION; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
1
|
|
|
1
|
|
12
|
my ($class, $opname, $mode, $sub) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
2
|
$^H |= 0x120000; # set HINT_LOCALIZE_HH + an unused bit to work around a %^H bug |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
50
|
|
|
8
|
my $by_opname = $^H{OPCHECK_leavescope} ||= {}; |
25
|
1
|
|
50
|
|
|
6
|
my $guards = $by_opname->{$opname} ||= []; |
26
|
|
|
|
|
|
|
push @$guards, Scope::Guard->new(sub { |
27
|
1
|
|
|
1
|
|
15
|
leavescope($opname, $mode, $sub); |
28
|
1
|
|
|
|
|
7
|
}); |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
36
|
enterscope($opname, $mode, $sub); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub unimport { |
34
|
1
|
|
|
1
|
|
44
|
my ($class, $opname) = @_; |
35
|
|
|
|
|
|
|
|
36
|
1
|
50
|
|
|
|
5
|
if ( defined $opname ) { |
37
|
0
|
|
|
|
|
0
|
my $by_opname = $^H{OPCHECK_leavescope}; |
38
|
0
|
|
|
|
|
0
|
delete $by_opname->{$opname}; |
39
|
0
|
0
|
|
|
|
0
|
return if scalar keys %$by_opname; # don't delete other things |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
4
|
delete $^H{OPCHECK_leavescope}; |
43
|
1
|
|
|
|
|
963
|
$^H &= ~0x120000; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |