line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package B::FindAmpersand; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
4706
|
require Config; |
4
|
1
|
50
|
|
|
|
27
|
die "B::FindAmpersand not supported for threaded perl" if $Config::Config{usethreads}; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use B; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
8
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
428
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = "0.04"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $evil = join "", qw"[ ` & ' ]"; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub compile { |
16
|
1
|
|
|
1
|
|
15
|
return sub { B::walkoptree(B::main_root(), "findampersand") } |
17
|
1
|
|
|
1
|
0
|
21
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub B::GVOP::findampersand { |
20
|
0
|
|
|
0
|
|
0
|
my($op, $level) = @_; |
21
|
0
|
|
|
|
|
0
|
$op->gv->findampersand($op); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub B::GV::findampersand { |
25
|
7
|
|
|
7
|
|
10
|
my($gv) = @_; |
26
|
7
|
100
|
|
|
|
75
|
return unless $gv->NAME =~ /^$evil$/; |
27
|
1
|
|
|
|
|
21
|
my @report = ($gv->NAME, $gv->FILEGV->SV->PV, $gv->LINE); |
28
|
1
|
|
|
|
|
16
|
warn sprintf "Found evil variable \$%s in file %s, line %s\n", @report; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
65
|
|
|
65
|
|
184
|
sub B::OP::findampersand {} |
32
|
|
|
|
|
|
|
*B::SVOP::findampersand = $] < 5.006 ? sub {} : sub { |
33
|
22
|
|
|
22
|
|
92
|
shift->gv->findampersand; |
34
|
|
|
|
|
|
|
}; |
35
|
1
|
|
|
1
|
|
4
|
sub B::PMOP::findampersand {} |
36
|
0
|
|
|
0
|
|
0
|
sub B::PVOP::findampersand {} |
37
|
16
|
|
|
16
|
|
53
|
sub B::COP::findampersand {} |
38
|
14
|
|
|
14
|
|
52
|
sub B::PV::findampersand {} |
39
|
0
|
|
|
0
|
|
0
|
sub B::AV::findampersand {} |
40
|
0
|
|
|
0
|
|
0
|
sub B::IV::findampersand {} |
41
|
0
|
|
|
0
|
|
0
|
sub B::NV::findampersand {} |
42
|
0
|
|
|
0
|
|
0
|
sub B::NULL::findampersand {} |
43
|
1
|
|
|
1
|
|
6
|
sub B::SPECIAL::findampersand {} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |