line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Kantan::Caller; |
2
|
4
|
|
|
4
|
|
26
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
193
|
|
3
|
4
|
|
|
4
|
|
29
|
use warnings; |
|
4
|
|
|
|
|
39
|
|
|
4
|
|
|
|
|
136
|
|
4
|
4
|
|
|
4
|
|
29
|
use utf8; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
38
|
|
5
|
4
|
|
|
4
|
|
188
|
use 5.010_001; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
167
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
19
|
use Cwd (); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
71
|
|
8
|
4
|
|
|
4
|
|
21
|
use File::Spec; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1810
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $BASE_DIR = Cwd::getcwd(); |
11
|
|
|
|
|
|
|
our %FILECACHE; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
1
|
0
|
sub package { shift->{package} } |
14
|
0
|
|
|
0
|
1
|
0
|
sub filename { shift->{filename} } |
15
|
0
|
|
|
0
|
1
|
0
|
sub line { shift->{line} } |
16
|
0
|
|
|
0
|
1
|
0
|
sub code { shift->{code} } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
62
|
|
|
62
|
1
|
103
|
my $class = shift; |
20
|
|
|
|
|
|
|
|
21
|
62
|
|
100
|
|
|
180
|
my $level = shift || 0; |
22
|
62
|
|
50
|
|
|
606
|
my $binmode = shift || '<:encoding(utf-8)'; |
23
|
|
|
|
|
|
|
|
24
|
62
|
|
|
|
|
429
|
my ($package, $filename, $line) = caller($level+1); |
25
|
62
|
50
|
|
|
|
193
|
return unless defined($package); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $code = sub { |
28
|
62
|
50
|
|
62
|
|
183
|
undef $filename if $filename eq '-e'; |
29
|
62
|
50
|
|
|
|
158
|
if (defined $filename) { |
30
|
62
|
|
|
|
|
1390
|
my $abs_filename = File::Spec->rel2abs($filename, $BASE_DIR); |
31
|
|
|
|
|
|
|
my $file = $FILECACHE{$abs_filename} ||= [ |
32
|
62
|
|
100
|
|
|
253
|
do { |
33
|
|
|
|
|
|
|
# Do not die if we can't open the file |
34
|
4
|
50
|
|
1
|
|
340
|
open my $fh, $binmode, $abs_filename |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
35
|
|
|
|
|
|
|
or return ''; |
36
|
|
|
|
|
|
|
<$fh> |
37
|
4
|
|
|
|
|
16302
|
} |
38
|
|
|
|
|
|
|
]; |
39
|
62
|
|
|
|
|
969
|
my $code = $file->[ $line - 1 ]; |
40
|
62
|
|
|
|
|
884
|
$code =~ s{^\s+|\s+$}{}g; |
41
|
62
|
|
|
|
|
163
|
$code; |
42
|
|
|
|
|
|
|
} else { |
43
|
0
|
|
|
|
|
0
|
""; |
44
|
|
|
|
|
|
|
} |
45
|
62
|
|
|
|
|
666
|
}->(); |
46
|
62
|
|
|
|
|
3034
|
return bless +{ |
47
|
|
|
|
|
|
|
package => $package, |
48
|
|
|
|
|
|
|
filename => $filename, |
49
|
|
|
|
|
|
|
line => $line, |
50
|
|
|
|
|
|
|
code => $code, |
51
|
|
|
|
|
|
|
}, $class; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
__END__ |