| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#line 1 |
|
2
|
|
|
|
|
|
|
package Sub::Uplevel; |
|
3
|
3
|
|
|
3
|
|
40
|
|
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
107
|
|
|
4
|
|
|
|
|
|
|
use 5.006; |
|
5
|
3
|
|
|
3
|
|
16
|
|
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
87
|
|
|
6
|
3
|
|
|
3
|
|
13
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
523
|
|
|
7
|
|
|
|
|
|
|
use vars qw($VERSION @ISA @EXPORT); |
|
8
|
|
|
|
|
|
|
$VERSION = 0.09; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# We have to do this so the CORE::GLOBAL versions override the builtins |
|
11
|
|
|
|
|
|
|
_setup_CORE_GLOBAL(); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Exporter; |
|
14
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
|
15
|
|
|
|
|
|
|
@EXPORT = qw(uplevel); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#line 73 |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $Up_Frames = 0; |
|
20
|
|
|
|
|
|
|
sub uplevel { |
|
21
|
|
|
|
|
|
|
my($num_frames, $func, @args) = @_; |
|
22
|
|
|
|
|
|
|
local $Up_Frames = $num_frames + $Up_Frames; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return $func->(@args); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _setup_CORE_GLOBAL { |
|
29
|
|
|
|
|
|
|
no warnings 'redefine'; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
*CORE::GLOBAL::caller = sub { |
|
32
|
|
|
|
|
|
|
my $height = $_[0] || 0; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#line 115 |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$height++; # up one to avoid this wrapper function. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $saw_uplevel = 0; |
|
39
|
|
|
|
|
|
|
# Yes, we need a C style for loop here since $height changes |
|
40
|
|
|
|
|
|
|
for( my $up = 1; $up <= $height + 1; $up++ ) { |
|
41
|
|
|
|
|
|
|
my @caller = CORE::caller($up); |
|
42
|
|
|
|
|
|
|
if( defined($caller[0]) and $caller[0] eq __PACKAGE__ ) { |
|
43
|
|
|
|
|
|
|
$height++; |
|
44
|
|
|
|
|
|
|
$height += $Up_Frames unless $saw_uplevel; |
|
45
|
|
|
|
|
|
|
$saw_uplevel = 1; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return undef if $height < 0; |
|
51
|
|
|
|
|
|
|
my @caller = CORE::caller($height); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
if( wantarray ) { |
|
54
|
|
|
|
|
|
|
if( !@_ ) { |
|
55
|
|
|
|
|
|
|
@caller = @caller[0..2]; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
return @caller; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
else { |
|
60
|
|
|
|
|
|
|
return $caller[0]; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
}; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#line 213 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |