… | |
… | |
151 | |
151 | |
152 | if ($depth) { |
152 | if ($depth) { |
153 | my (@about) = find $$refref; |
153 | my (@about) = find $$refref; |
154 | if (@about) { |
154 | if (@about) { |
155 | for my $about (@about) { |
155 | for my $about (@about) { |
|
|
156 | $about->[0] =~ s/([^\x20-\x7e])/sprintf "\\{%02x}", ord $1/ge; |
156 | $buf .= "$indent" . (@about > 1 ? "+- " : "") . $about->[0]; |
157 | $buf .= "$indent" . (@about > 1 ? "+- " : "") . $about->[0]; |
157 | if (@$about > 1) { |
158 | if (@$about > 1) { |
158 | if ($seen{ref2ptr $about->[1]}++) { |
159 | if ($seen{ref2ptr $about->[1]}++) { |
159 | $buf .= " " . (_f $about->[1]) . ", which was seen before.\n"; |
160 | $buf .= " " . (_f $about->[1]) . ", which was seen before.\n"; |
160 | } else { |
161 | } else { |
… | |
… | |
172 | $buf .= "$indent not referenced within the search depth.\n"; |
173 | $buf .= "$indent not referenced within the search depth.\n"; |
173 | } |
174 | } |
174 | }; |
175 | }; |
175 | |
176 | |
176 | $buf .= (_f $ref) . " is\n"; |
177 | $buf .= (_f $ref) . " is\n"; |
|
|
178 | |
177 | $track->(\$ref, $depth || $ENV{PERL_DEVEL_FINDREF_DEPTH} || 10, ""); |
179 | $track->(\$ref, $depth || $ENV{PERL_DEVEL_FINDREF_DEPTH} || 10, ""); |
178 | $buf |
180 | $buf |
179 | } |
181 | } |
180 | |
182 | |
181 | =item @references = Devel::FindRef::find $ref |
183 | =item @references = Devel::FindRef::find $ref |
… | |
… | |
191 | =cut |
193 | =cut |
192 | |
194 | |
193 | sub find($) { |
195 | sub find($) { |
194 | my ($about, $excl) = &find_; |
196 | my ($about, $excl) = &find_; |
195 | my %excl = map +($_ => undef), @$excl; |
197 | my %excl = map +($_ => undef), @$excl; |
196 | grep !exists $excl{ref2ptr $_->[1]}, @$about |
198 | grep !($#$_ && exists $excl{ref2ptr $_->[1]}), @$about |
197 | } |
199 | } |
198 | |
200 | |
199 | =item $ref = Devel::FindRef::ptr2ref $integer |
201 | =item $ref = Devel::FindRef::ptr2ref $integer |
200 | |
202 | |
201 | Sometimes you know (from debugging output) the address of a perl scalar |
203 | Sometimes you know (from debugging output) the address of a perl scalar |