line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eval::Util; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2018-03-12'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
56864
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
314
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
11
|
|
|
|
|
|
|
inside_eval |
12
|
|
|
|
|
|
|
inside_block_eval |
13
|
|
|
|
|
|
|
inside_string_eval |
14
|
|
|
|
|
|
|
eval_level |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
# XXX block_eval_level |
17
|
|
|
|
|
|
|
# XXX string_eval_level |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub inside_eval { |
20
|
3
|
|
|
3
|
1
|
109
|
my $i = 0; |
21
|
3
|
|
|
|
|
3
|
while (1) { |
22
|
6
|
|
|
|
|
25
|
my ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext) = #, $is_require, $hints, $bitmask, $hinthash |
23
|
|
|
|
|
|
|
caller($i); |
24
|
6
|
100
|
|
|
|
13
|
last unless defined $package; |
25
|
5
|
|
|
|
|
5
|
$i++; |
26
|
5
|
100
|
66
|
|
|
13
|
if ($subroutine eq "(eval)" || defined $evaltext) { |
27
|
2
|
|
|
|
|
8
|
return 1; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
}; |
30
|
1
|
|
|
|
|
2
|
0; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub inside_block_eval { |
34
|
3
|
|
|
3
|
1
|
39
|
my $i = 0; |
35
|
3
|
|
|
|
|
5
|
while (1) { |
36
|
7
|
|
|
|
|
32
|
my ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext) = #, $is_require, $hints, $bitmask, $hinthash |
37
|
|
|
|
|
|
|
caller($i); |
38
|
7
|
100
|
|
|
|
13
|
last unless defined $package; |
39
|
5
|
|
|
|
|
5
|
$i++; |
40
|
5
|
100
|
100
|
|
|
14
|
if ($subroutine eq "(eval)" && !defined($evaltext)) { |
41
|
1
|
|
|
|
|
2
|
return 1; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
}; |
44
|
2
|
|
|
|
|
7
|
0; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub inside_string_eval { |
48
|
3
|
|
|
3
|
1
|
39
|
my $i = 0; |
49
|
3
|
|
|
|
|
4
|
while (1) { |
50
|
7
|
|
|
|
|
29
|
my ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext) = #, $is_require, $hints, $bitmask, $hinthash |
51
|
|
|
|
|
|
|
caller($i); |
52
|
7
|
100
|
|
|
|
13
|
last unless defined $package; |
53
|
5
|
|
|
|
|
7
|
$i++; |
54
|
5
|
100
|
100
|
|
|
14
|
if ($subroutine eq "(eval)" && defined($evaltext)) { |
55
|
1
|
|
|
|
|
5
|
return 1; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
}; |
58
|
2
|
|
|
|
|
3
|
0; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub eval_level { |
62
|
3
|
|
|
3
|
1
|
22
|
my $i = 0; |
63
|
3
|
|
|
|
|
4
|
my $level = 0; |
64
|
3
|
|
|
|
|
4
|
while (1) { |
65
|
9
|
|
|
|
|
23
|
my ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext) = #, $is_require, $hints, $bitmask, $hinthash |
66
|
|
|
|
|
|
|
caller($i); |
67
|
9
|
100
|
|
|
|
15
|
last unless defined $package; |
68
|
6
|
|
|
|
|
7
|
$i++; |
69
|
6
|
100
|
66
|
|
|
13
|
if ($subroutine eq "(eval)" || defined $evaltext) { |
70
|
3
|
|
|
|
|
3
|
$level++; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
}; |
73
|
3
|
|
|
|
|
4
|
$level; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
# ABSTRACT: Utilities related to eval() |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |