line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Util::Underscore::CallStackFrame; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#ABSTRACT: object-oriented wrapper for "caller" builtin |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
16303
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
68
|
|
6
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
83
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Carp (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
640
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## no critic (RequireFinalReturn) |
11
|
|
|
|
|
|
|
# reason: performance and terse code. |
12
|
|
|
|
|
|
|
# All methods are supposed to return something. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
## no critic (ProhibitMagicNumbers) |
15
|
|
|
|
|
|
|
# reason: the "caller" builtin is full of magic numbers. |
16
|
|
|
|
|
|
|
# This class wraps them so that users don't have to deal with them. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub of { |
20
|
57
|
|
|
57
|
1
|
23505
|
my ($class, $level) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package DB; ## no critic (ProhibitMUltiplePackages) |
23
|
57
|
|
|
|
|
338
|
my @caller = CORE::caller($level + 1); |
24
|
57
|
100
|
|
|
|
179
|
return if not @caller; |
25
|
54
|
|
|
|
|
119
|
push @caller, [@DB::args]; ## no critic (ProhibitPackageVars) |
26
|
54
|
|
|
|
|
234
|
return bless \@caller => $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
## no critic (ProhibitBuiltinHomonyms) |
31
|
4
|
|
|
4
|
1
|
4482
|
sub package { shift()->[0] } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
4
|
|
|
4
|
1
|
21
|
sub file { shift()->[1] } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
17
|
|
|
17
|
1
|
74
|
sub line { shift()->[2] } |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
28
|
|
|
28
|
1
|
10976
|
sub subroutine { shift()->[3] } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub has_args { |
44
|
3
|
|
|
3
|
1
|
6
|
my ($self) = @_; |
45
|
3
|
100
|
|
|
|
22
|
$self->[4] && $self->[11]; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
4
|
|
|
4
|
1
|
23
|
sub wantarray { shift()->[5] } |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub is_eval { |
53
|
9
|
|
|
9
|
1
|
39
|
my ($self) = @_; |
54
|
9
|
100
|
|
|
|
27
|
if ($self->[3] eq '(eval)') { |
55
|
8
|
|
|
|
|
15
|
my $accessor_object = [ @{$self}[ 6, 7 ] ]; |
|
8
|
|
|
|
|
23
|
|
56
|
8
|
|
|
|
|
32
|
bless $accessor_object => 'Util::Underscore::CallStackFrame::_Eval'; |
57
|
8
|
|
|
|
|
31
|
return $accessor_object; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else { |
60
|
1
|
|
|
|
|
5
|
return !!0; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
{ |
65
|
|
|
|
|
|
|
## no critic (ProhibitMUltiplePackages) |
66
|
|
|
|
|
|
|
package Util::Underscore::CallStackFrame::_Eval; |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
2
|
|
50
|
sub source { shift()->[0] } |
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
3
|
|
15
|
sub is_require { shift()->[1] } |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
3
|
|
|
3
|
1
|
14
|
sub is_require { shift()->[7] } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
1
|
1
|
11
|
sub hints { shift()->[8] } |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
1
|
11
|
sub bitmask { shift()->[9] } |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
1
|
0
|
10
|
sub hinthash { shift()->[10] } |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |