line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl6::Caller; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
60668
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
132
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.100'; |
7
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
3587
|
use overload '""' => \&package, fallback => 1; |
|
2
|
|
|
|
|
2190
|
|
|
2
|
|
|
|
|
18
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
2
|
|
|
2
|
|
13
|
my ($class) = @_; |
13
|
2
|
|
|
|
|
11
|
my $callpack = caller; |
14
|
2
|
|
|
2
|
|
162
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
446
|
|
15
|
2
|
|
|
|
|
4
|
*{"$callpack\::caller"} = \&caller; |
|
2
|
|
|
|
|
2895
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub caller { |
19
|
92
|
|
100
|
92
|
1
|
35268
|
my $thing = shift || 0; |
20
|
92
|
50
|
0
|
|
|
184
|
my $frame = |
21
|
|
|
|
|
|
|
__PACKAGE__ eq $thing |
22
|
|
|
|
|
|
|
? ( shift || 0 ) |
23
|
|
|
|
|
|
|
: $thing; |
24
|
92
|
|
|
|
|
192
|
return __PACKAGE__->new($frame); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my @methods; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
BEGIN { |
30
|
2
|
|
|
2
|
|
8
|
@methods = qw/package filename line subroutine hasargs |
31
|
|
|
|
|
|
|
wantarray evaltext is_require/; |
32
|
2
|
|
|
|
|
4
|
foreach my $method (@methods) { |
33
|
2
|
|
|
2
|
|
11
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
140
|
|
34
|
|
|
|
|
|
|
*$method = sub { |
35
|
88
|
|
|
88
|
|
1748
|
my ( $self, $frame ) = @_; |
36
|
88
|
|
|
|
|
441
|
return $self->{$method}; |
37
|
16
|
|
|
|
|
337
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
94
|
|
|
94
|
0
|
1303
|
my $class = shift; |
43
|
94
|
100
|
100
|
|
|
269
|
my $frame = @_ ? (shift || 0) : -1; |
44
|
94
|
|
|
|
|
92
|
$frame += 2; |
45
|
|
|
|
|
|
|
|
46
|
94
|
|
|
|
|
192
|
my $self = bless {} => __PACKAGE__; |
47
|
94
|
|
|
|
|
341
|
my @caller = CORE::caller($frame); |
48
|
94
|
100
|
|
|
|
209
|
return @caller if CORE::wantarray; |
49
|
84
|
|
|
|
|
568
|
@$self{@methods} = @caller; |
50
|
84
|
|
|
|
|
329
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |