line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
### !!!ACHTUNG!!! |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This module is to be loaded at configure time straight from the Makefile.PL |
4
|
|
|
|
|
|
|
# in order to get access to some of the constants / utils |
5
|
|
|
|
|
|
|
# None of the dependencies will be available yet at this point, so make |
6
|
|
|
|
|
|
|
# sure to never use anything beyond what the minimum supported perl came with |
7
|
|
|
|
|
|
|
# (no, relying on configure_requires is not ok) |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package namespace::clean::_Util; |
10
|
|
|
|
|
|
|
|
11
|
11
|
|
|
11
|
|
55
|
use warnings; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
291
|
|
12
|
11
|
|
|
11
|
|
55
|
use strict; |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
222
|
|
13
|
|
|
|
|
|
|
|
14
|
11
|
|
|
11
|
|
53
|
use base 'Exporter'; |
|
11
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
1607
|
|
15
|
|
|
|
|
|
|
our @EXPORT_OK = qw( stash_for DEBUGGER_NEEDS_CV_RENAME DEBUGGER_NEEDS_CV_PIVOT ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# FIXME This is a crock of shit, needs to go away |
18
|
|
|
|
|
|
|
# currently here to work around https://rt.cpan.org/Ticket/Display.html?id=74151 |
19
|
|
|
|
|
|
|
# kill ith fire when PS::XS is *finally* fixed |
20
|
|
|
|
|
|
|
BEGIN { |
21
|
11
|
|
|
11
|
|
22
|
my $provider; |
22
|
|
|
|
|
|
|
|
23
|
11
|
50
|
|
|
|
48
|
if ( $] < 5.008007 ) { |
24
|
0
|
|
|
|
|
0
|
require Package::Stash::PP; |
25
|
0
|
|
|
|
|
0
|
$provider = 'Package::Stash::PP'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else { |
28
|
11
|
|
|
|
|
7655
|
require Package::Stash; |
29
|
11
|
|
|
|
|
19088
|
$provider = 'Package::Stash'; |
30
|
|
|
|
|
|
|
} |
31
|
11
|
50
|
|
1063
|
0
|
890
|
eval <<"EOS" or die $@; |
|
1063
|
|
|
|
|
9620
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub stash_for (\$) { |
34
|
|
|
|
|
|
|
$provider->new(\$_[0]); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
EOS |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
11
|
|
33
|
11
|
|
64
|
use constant DEBUGGER_NEEDS_CV_RENAME => ( ( $] > 5.008_008 ) and ( $] < 5.013_006 ) ); |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
881
|
|
43
|
11
|
|
|
11
|
|
53
|
use constant DEBUGGER_NEEDS_CV_PIVOT => ( ( ! DEBUGGER_NEEDS_CV_RENAME ) and ( $] < 5.015_005 ) ); |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
836
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# FIXME - ideally this needs to be provided by some abstraction lib |
46
|
|
|
|
|
|
|
# but we don't have that yet |
47
|
|
|
|
|
|
|
BEGIN { |
48
|
11
|
|
|
11
|
|
243
|
DEBUGGER_NEEDS_CV_RENAME and ( eval <<'EOS' or die $@ ); |
49
|
|
|
|
|
|
|
{ |
50
|
|
|
|
|
|
|
my( $sub_name_loaded, $sub_util_loaded ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _namer_load_error { |
53
|
|
|
|
|
|
|
my $err = ''; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
return $err if $sub_util_loaded or $sub_name_loaded; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
local $@; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# prefer Sub::Name to Sub::Util |
60
|
|
|
|
|
|
|
# this is rather arbitrary but remember this code exists only |
61
|
|
|
|
|
|
|
# on perls 5.8.9 ~ 5.13.5 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# when changing version also change in Makefile.PL |
64
|
|
|
|
|
|
|
my $sn_ver = 0.04; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
eval { |
67
|
|
|
|
|
|
|
require Sub::Name; |
68
|
|
|
|
|
|
|
Sub::Name->VERSION($sn_ver); |
69
|
|
|
|
|
|
|
$sub_name_loaded = 1; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
or |
72
|
|
|
|
|
|
|
eval { |
73
|
|
|
|
|
|
|
require Sub::Util; |
74
|
|
|
|
|
|
|
$sub_util_loaded = 1; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
or |
77
|
|
|
|
|
|
|
$err = "When running under -d on this perl $], namespace::clean requires either Sub::Name $sn_ver or Sub::Util to be installed" |
78
|
|
|
|
|
|
|
; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$err; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub set_subname { |
84
|
|
|
|
|
|
|
if( my $err = _namer_load_error() ) { |
85
|
|
|
|
|
|
|
die $err; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
elsif( $sub_name_loaded ) { |
88
|
|
|
|
|
|
|
&Sub::Name::subname; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
elsif( $sub_util_loaded ) { |
91
|
|
|
|
|
|
|
&Sub::Util::set_subname; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
else { |
94
|
|
|
|
|
|
|
die "How the fuck did we get here? Read source and debug please!"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub get_subname { |
99
|
|
|
|
|
|
|
if( |
100
|
|
|
|
|
|
|
_namer_load_error() |
101
|
|
|
|
|
|
|
or |
102
|
|
|
|
|
|
|
! $sub_util_loaded |
103
|
|
|
|
|
|
|
) { |
104
|
|
|
|
|
|
|
require B; |
105
|
|
|
|
|
|
|
my $gv = B::svref_2object( $_[0] )->GV; |
106
|
|
|
|
|
|
|
join '::', $gv->STASH->NAME, $gv->NAME; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
else { |
109
|
|
|
|
|
|
|
&Sub::Util::subname; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
EOS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |