line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Caller::Hide; |
2
|
2
|
|
|
2
|
|
135946
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
58
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
976
|
use version 0.77; our $VERSION = version->declare('v0.0.1'); |
|
2
|
|
|
|
|
3928
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
1094
|
use parent 'Exporter'; |
|
2
|
|
|
|
|
506
|
|
|
2
|
|
|
|
|
11
|
|
6
|
2
|
|
|
2
|
|
109
|
use Carp; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
200
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw[ hide_package reveal_package ]; |
9
|
|
|
|
|
|
|
our %EXPORT_TAGS = (ALL => \@EXPORT_OK); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %hidden; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
{ # adapted from Hook::LexWrap |
14
|
2
|
|
|
2
|
|
14
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
607
|
|
15
|
|
|
|
|
|
|
*CORE::GLOBAL::caller = sub (;$) { |
16
|
76
|
|
100
|
76
|
|
13163
|
my ($height) = ($_[0] || 0); |
17
|
76
|
|
|
|
|
102
|
my $i = 1; |
18
|
76
|
|
|
|
|
93
|
my $name_cache; |
19
|
76
|
|
|
|
|
98
|
while (1) { |
20
|
|
|
|
|
|
|
my @caller |
21
|
|
|
|
|
|
|
= CORE::caller() eq 'DB' |
22
|
321
|
50
|
|
|
|
1096
|
? do { package DB; CORE::caller($i++) } |
|
0
|
|
|
|
|
0
|
|
23
|
|
|
|
|
|
|
: CORE::caller($i++); |
24
|
321
|
100
|
|
|
|
679
|
return if not @caller; |
25
|
304
|
100
|
|
|
|
514
|
$caller[3] = $name_cache if $name_cache; |
26
|
304
|
100
|
|
|
|
538
|
$name_cache = $hidden{ $caller[0] } ? $caller[3] : ''; |
27
|
304
|
100
|
100
|
|
|
863
|
next if $name_cache || $height-- != 0; |
28
|
59
|
100
|
|
|
|
191
|
return wantarray ? @_ ? @caller : @caller[ 0 .. 2 ] : $caller[0]; |
|
|
100
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub hide_package { |
34
|
6
|
|
|
6
|
1
|
3632
|
my ($package) = @_; |
35
|
6
|
|
|
|
|
14
|
$hidden{$package} = 1; |
36
|
6
|
|
|
|
|
24
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub reveal_package { |
40
|
6
|
|
|
6
|
1
|
3116
|
my ($package) = @_; |
41
|
6
|
50
|
|
|
|
19
|
Carp::carp "$package not hidden" if not $hidden{$package}; |
42
|
|
|
|
|
|
|
|
43
|
6
|
|
|
|
|
10
|
delete $hidden{$package}; |
44
|
6
|
|
|
|
|
11
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |