line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Kantan::Caller; |
2
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
126
|
|
3
|
4
|
|
|
4
|
|
28
|
use warnings; |
|
4
|
|
|
|
|
36
|
|
|
4
|
|
|
|
|
139
|
|
4
|
4
|
|
|
4
|
|
18
|
use utf8; |
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
27
|
|
5
|
4
|
|
|
4
|
|
175
|
use 5.010_001; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
129
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
22
|
use Cwd (); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
64
|
|
8
|
4
|
|
|
4
|
|
18
|
use File::Spec; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
1671
|
|
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
|
29
|
|
|
29
|
1
|
53
|
my $class = shift; |
20
|
|
|
|
|
|
|
|
21
|
29
|
|
100
|
|
|
86
|
my $level = shift || 0; |
22
|
29
|
|
50
|
|
|
127
|
my $binmode = shift || '<:encoding(utf-8)'; |
23
|
|
|
|
|
|
|
|
24
|
29
|
|
|
|
|
197
|
my ($package, $filename, $line) = caller($level+1); |
25
|
29
|
50
|
|
|
|
85
|
return unless defined($package); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $code = sub { |
28
|
29
|
50
|
|
29
|
|
84
|
undef $filename if $filename eq '-e'; |
29
|
29
|
50
|
|
|
|
84
|
if (defined $filename) { |
30
|
29
|
|
|
|
|
820
|
my $abs_filename = File::Spec->rel2abs($filename, $BASE_DIR); |
31
|
|
|
|
|
|
|
my $file = $FILECACHE{$abs_filename} ||= [ |
32
|
29
|
|
100
|
|
|
117
|
do { |
33
|
|
|
|
|
|
|
# Do not die if we can't open the file |
34
|
3
|
50
|
|
1
|
|
302
|
open my $fh, $binmode, $abs_filename |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
35
|
|
|
|
|
|
|
or return ''; |
36
|
|
|
|
|
|
|
<$fh> |
37
|
3
|
|
|
|
|
15520
|
} |
38
|
|
|
|
|
|
|
]; |
39
|
29
|
|
|
|
|
374
|
my $code = $file->[ $line - 1 ]; |
40
|
29
|
|
|
|
|
383
|
$code =~ s{^\s+|\s+$}{}g; |
41
|
29
|
|
|
|
|
84
|
$code; |
42
|
|
|
|
|
|
|
} else { |
43
|
0
|
|
|
|
|
0
|
""; |
44
|
|
|
|
|
|
|
} |
45
|
29
|
|
|
|
|
179
|
}->(); |
46
|
29
|
|
|
|
|
541
|
return bless +{ |
47
|
|
|
|
|
|
|
package => $package, |
48
|
|
|
|
|
|
|
filename => $filename, |
49
|
|
|
|
|
|
|
line => $line, |
50
|
|
|
|
|
|
|
code => $code, |
51
|
|
|
|
|
|
|
}, $class; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
__END__ |