line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package autocroak; |
2
|
|
|
|
|
|
|
$autocroak::VERSION = '0.007'; |
3
|
5
|
|
|
5
|
|
378397
|
use strict; |
|
5
|
|
|
|
|
45
|
|
|
5
|
|
|
|
|
109
|
|
4
|
5
|
|
|
5
|
|
22
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
109
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
21
|
use XSLoader; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
1683
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
XSLoader::load(__PACKAGE__, __PACKAGE__->VERSION); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %key_for = ( |
11
|
|
|
|
|
|
|
pipe => 'PIPE_OP', |
12
|
|
|
|
|
|
|
getsockopt => 'GSOCKOPT', |
13
|
|
|
|
|
|
|
setsockopt => 'SSOCKOPT', |
14
|
|
|
|
|
|
|
opendir => 'OPEN_DIR', |
15
|
|
|
|
|
|
|
do => 'DOFILE', |
16
|
|
|
|
|
|
|
gethostbyaddr => 'GHBYADDR', |
17
|
|
|
|
|
|
|
getnetbyaddr => 'GNBYADDR', |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
-R => 'FTRREAD', |
20
|
|
|
|
|
|
|
-W => 'FTRWRITE', |
21
|
|
|
|
|
|
|
-X => 'FTREXEC', |
22
|
|
|
|
|
|
|
-r => 'FTEREAD', |
23
|
|
|
|
|
|
|
-w => 'FTEWRITE', |
24
|
|
|
|
|
|
|
-x => 'FTEEXEC', |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
-e => "FTIS", |
27
|
|
|
|
|
|
|
-s => "FTSIZE", |
28
|
|
|
|
|
|
|
-M => "FTMTIME", |
29
|
|
|
|
|
|
|
-C => "FTCTIME", |
30
|
|
|
|
|
|
|
-A => "FTATIME", |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
-O => "FTROWNED", |
33
|
|
|
|
|
|
|
-o => "FTEOWNED", |
34
|
|
|
|
|
|
|
-z => "FTZERO", |
35
|
|
|
|
|
|
|
-S => "FTSOCK", |
36
|
|
|
|
|
|
|
-c => "FTCHR", |
37
|
|
|
|
|
|
|
-b => "FTBLK", |
38
|
|
|
|
|
|
|
-f => "FTFILE", |
39
|
|
|
|
|
|
|
-d => "FTDIR", |
40
|
|
|
|
|
|
|
-p => "FTPIPE", |
41
|
|
|
|
|
|
|
-u => "FTSUID", |
42
|
|
|
|
|
|
|
-g => "FTSGID", |
43
|
|
|
|
|
|
|
-k => "FTSVTX", |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
-l => "FTLINK", |
46
|
|
|
|
|
|
|
-t => "FTTTY", |
47
|
|
|
|
|
|
|
-T => "FTTEXT", |
48
|
|
|
|
|
|
|
-B => "FTBINARY", |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub import { |
52
|
13
|
|
|
13
|
|
90
|
my (undef, %args) = @_; |
53
|
13
|
|
|
|
|
28
|
$^H |= 0x020000; |
54
|
13
|
|
|
|
|
52
|
$^H{"autocroak/enabled"} = 1; |
55
|
|
|
|
|
|
|
|
56
|
13
|
|
|
|
|
18
|
for my $op_name (keys %{ $args{allow} }) { |
|
13
|
|
|
|
|
2436
|
|
57
|
4
|
|
66
|
|
|
20
|
my $op_key = $key_for{$op_name} // uc $op_name; |
58
|
4
|
|
|
|
|
8
|
my $key = "autocroak/$op_key"; |
59
|
4
|
|
50
|
|
|
32
|
$^H{$key} //= ''; |
60
|
4
|
|
|
|
|
5
|
my $values = $args{allow}{$op_name}; |
61
|
4
|
50
|
|
|
|
12
|
for my $value (ref $values ? @{ $values } : $values) { |
|
0
|
|
|
|
|
0
|
|
62
|
4
|
|
|
|
|
3818
|
vec($^H{$key}, $value, 1) = 1; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub unimport { |
68
|
0
|
|
|
0
|
|
|
my (undef, %args) = @_; |
69
|
0
|
|
|
|
|
|
$^H |= 0x020000; |
70
|
0
|
|
|
|
|
|
delete $^H{$_} for grep m{^autocroak/}, keys %^H; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# ABSTRACT: Replace functions with ones that succeed or die with lexical scope |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |