line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package B::OPCheck; # git description: 0.29-6-g1b4433f |
2
|
|
|
|
|
|
|
# ABSTRACT: PL_check hacks using Perl callbacks |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
19994
|
use 5.008; |
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
95
|
|
10
|
1
|
|
|
1
|
|
4
|
use XSLoader; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
11
|
1
|
|
|
1
|
|
4
|
use Scalar::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
12
|
1
|
|
|
1
|
|
769
|
use Scope::Guard; |
|
1
|
|
|
|
|
376
|
|
|
1
|
|
|
|
|
43
|
|
13
|
1
|
|
|
1
|
|
789
|
use B::Utils 0.08 (); |
|
1
|
|
|
|
|
6194
|
|
|
1
|
|
|
|
|
223
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
XSLoader::load 'B::OPCheck', $VERSION; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
1
|
|
|
1
|
|
17
|
my ($class, $opname, $mode, $sub) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
3
|
$^H |= 0x120000; # set HINT_LOCALIZE_HH + an unused bit to work around a %^H bug |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
50
|
|
|
13
|
my $by_opname = $^H{OPCHECK_leavescope} ||= {}; |
25
|
1
|
|
50
|
|
|
7
|
my $guards = $by_opname->{$opname} ||= []; |
26
|
|
|
|
|
|
|
push @$guards, Scope::Guard->new(sub { |
27
|
1
|
|
|
1
|
|
18
|
leavescope($opname, $mode, $sub); |
28
|
1
|
|
|
|
|
8
|
}); |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
53
|
enterscope($opname, $mode, $sub); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub unimport { |
34
|
1
|
|
|
1
|
|
60
|
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
|
|
|
|
|
6
|
delete $^H{OPCHECK_leavescope}; |
43
|
1
|
|
|
|
|
1516
|
$^H &= ~0x120000; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |