… | |
… | |
12 | # define SVt_LAST 16 |
12 | # define SVt_LAST 16 |
13 | #endif |
13 | #endif |
14 | |
14 | |
15 | #if !PERL_VERSION_ATLEAST (5,10,0) |
15 | #if !PERL_VERSION_ATLEAST (5,10,0) |
16 | # define SvPAD_OUR(dummy) 0 |
16 | # define SvPAD_OUR(dummy) 0 |
|
|
17 | #endif |
|
|
18 | |
|
|
19 | /* pre-5.10 perls always succeed, with 5.10, we have to check first apparently */ |
|
|
20 | #ifndef GvNAME_HEK |
|
|
21 | # define GvNAME_HEK(sv) 1 |
17 | #endif |
22 | #endif |
18 | |
23 | |
19 | #define res_pair(text) \ |
24 | #define res_pair(text) \ |
20 | do { \ |
25 | do { \ |
21 | AV *av = newAV (); \ |
26 | AV *av = newAV (); \ |
… | |
… | |
32 | av_push (av, newSVpv (text, 0)); \ |
37 | av_push (av, newSVpv (text, 0)); \ |
33 | av_push (about, newRV_noinc ((SV *)av)); \ |
38 | av_push (about, newRV_noinc ((SV *)av)); \ |
34 | } while (0) |
39 | } while (0) |
35 | |
40 | |
36 | #define res_gv(sigil) \ |
41 | #define res_gv(sigil) \ |
37 | res_text (form ("in the global %c%s::%.*s", sigil, \ |
42 | res_text (form ("the global %c%s::%.*s", sigil, \ |
38 | HvNAME (GvSTASH (sv)), \ |
43 | HvNAME (GvSTASH (sv)), \ |
39 | GvNAMELEN (sv), \ |
44 | GvNAME_HEK (sv) ? GvNAMELEN (sv) : 11, \ |
40 | GvNAME (sv) ? GvNAME (sv) : "<anonymous>")) |
45 | GvNAME_HEK (sv) ? GvNAME (sv) : "<anonymous>")) |
41 | |
46 | |
42 | MODULE = Devel::FindRef PACKAGE = Devel::FindRef |
47 | MODULE = Devel::FindRef PACKAGE = Devel::FindRef |
43 | |
48 | |
44 | PROTOTYPES: ENABLE |
49 | PROTOTYPES: ENABLE |
45 | |
50 | |
… | |
… | |
127 | { |
132 | { |
128 | case SVt_PVAV: |
133 | case SVt_PVAV: |
129 | if (AvREAL (sv)) |
134 | if (AvREAL (sv)) |
130 | for (i = AvFILLp (sv) + 1; i--; ) |
135 | for (i = AvFILLp (sv) + 1; i--; ) |
131 | if (AvARRAY (sv)[i] == targ) |
136 | if (AvARRAY (sv)[i] == targ) |
132 | res_pair (form ("in array element %d of", i)); |
137 | res_pair (form ("the array element %d of", i)); |
133 | |
138 | |
134 | break; |
139 | break; |
135 | |
140 | |
136 | case SVt_PVHV: |
141 | case SVt_PVHV: |
137 | if (hv_iterinit ((HV *)sv)) |
142 | if (hv_iterinit ((HV *)sv)) |
138 | { |
143 | { |
139 | HE *he; |
144 | HE *he; |
140 | |
145 | |
141 | while ((he = hv_iternext ((HV *)sv))) |
146 | while ((he = hv_iternext ((HV *)sv))) |
142 | if (HeVAL (he) == targ) |
147 | if (HeVAL (he) == targ) |
143 | res_pair (form ("in the member '%.*s' of", HeKLEN (he), HeKEY (he))); |
148 | res_pair (form ("the member '%.*s' of", HeKLEN (he), HeKEY (he))); |
144 | } |
149 | } |
145 | |
150 | |
146 | break; |
151 | break; |
147 | |
152 | |
148 | case SVt_PVCV: |
153 | case SVt_PVCV: |
… | |
… | |
172 | { |
177 | { |
173 | /* Values from constant functions are stored in the pad without any name */ |
178 | /* Values from constant functions are stored in the pad without any name */ |
174 | SV *name_sv = AvARRAY (AvARRAY (padlist)[0])[i]; |
179 | SV *name_sv = AvARRAY (AvARRAY (padlist)[0])[i]; |
175 | |
180 | |
176 | if (name_sv && SvPOK (name_sv)) |
181 | if (name_sv && SvPOK (name_sv)) |
177 | res_pair (form ("in the lexical '%s' in", SvPVX (name_sv))); |
182 | res_pair (form ("the lexical '%s' in", SvPVX (name_sv))); |
178 | else |
183 | else |
179 | res_pair ("in an unnamed lexical in"); |
184 | res_pair ("an unnamed lexical in"); |
180 | } |
185 | } |
181 | |
186 | |
182 | --depth; |
187 | --depth; |
183 | } |
188 | } |
184 | } |
189 | } |