line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Kantan::Caller; |
2
|
4
|
|
|
4
|
|
17
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
117
|
|
3
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
35
|
|
|
4
|
|
|
|
|
82
|
|
4
|
4
|
|
|
4
|
|
13
|
use utf8; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
26
|
|
5
|
4
|
|
|
4
|
|
106
|
use 5.010_001; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
107
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
12
|
use Cwd (); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
44
|
|
8
|
4
|
|
|
4
|
|
14
|
use File::Spec; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1106
|
|
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
|
63
|
my $class = shift; |
20
|
|
|
|
|
|
|
|
21
|
62
|
|
100
|
|
|
127
|
my $level = shift || 0; |
22
|
62
|
|
50
|
|
|
196
|
my $binmode = shift || '<:encoding(utf-8)'; |
23
|
|
|
|
|
|
|
|
24
|
62
|
|
|
|
|
320
|
my ($package, $filename, $line) = caller($level+1); |
25
|
62
|
50
|
|
|
|
155
|
return unless defined($package); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $code = sub { |
28
|
62
|
50
|
|
62
|
|
122
|
undef $filename if $filename eq '-e'; |
29
|
62
|
50
|
|
|
|
107
|
if (defined $filename) { |
30
|
62
|
|
|
|
|
1032
|
my $abs_filename = File::Spec->rel2abs($filename, $BASE_DIR); |
31
|
|
|
|
|
|
|
my $file = $FILECACHE{$abs_filename} ||= [ |
32
|
62
|
|
100
|
|
|
176
|
do { |
33
|
|
|
|
|
|
|
# Do not die if we can't open the file |
34
|
3
|
50
|
|
1
|
|
139
|
open my $fh, $binmode, $abs_filename |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
35
|
|
|
|
|
|
|
or return ''; |
36
|
|
|
|
|
|
|
<$fh> |
37
|
3
|
|
|
|
|
9248
|
} |
38
|
|
|
|
|
|
|
]; |
39
|
62
|
|
|
|
|
437
|
my $code = $file->[ $line - 1 ]; |
40
|
62
|
|
|
|
|
649
|
$code =~ s{^\s+|\s+$}{}g; |
41
|
62
|
|
|
|
|
123
|
$code; |
42
|
|
|
|
|
|
|
} else { |
43
|
0
|
|
|
|
|
0
|
""; |
44
|
|
|
|
|
|
|
} |
45
|
62
|
|
|
|
|
388
|
}->(); |
46
|
62
|
|
|
|
|
831
|
return bless +{ |
47
|
|
|
|
|
|
|
package => $package, |
48
|
|
|
|
|
|
|
filename => $filename, |
49
|
|
|
|
|
|
|
line => $line, |
50
|
|
|
|
|
|
|
code => $code, |
51
|
|
|
|
|
|
|
}, $class; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
__END__ |