… | |
… | |
118 | |
118 | |
119 | if ($depth) { |
119 | if ($depth) { |
120 | my (@about) = find $$refref; |
120 | my (@about) = find $$refref; |
121 | if (@about) { |
121 | if (@about) { |
122 | for my $about (@about) { |
122 | for my $about (@about) { |
123 | $buf .= (" ") x $indent; |
123 | $buf .= "$indent" . (@about > 1 ? "+- " : " ") . $about->[0]; |
124 | $buf .= $about->[0]; |
|
|
125 | if (@$about > 1) { |
124 | if (@$about > 1) { |
126 | if ($seen{$about->[1]+0}++) { |
125 | if ($seen{$about->[1]+0}++) { |
127 | $buf .= " $about->[1], which was seen before.\n"; |
126 | $buf .= " $about->[1], which was seen before.\n"; |
128 | } else { |
127 | } else { |
129 | $buf .= " $about->[1], which is\n"; |
128 | $buf .= " $about->[1], which is\n"; |
130 | $track->(\$about->[1], $depth - 1, $indent + 1); |
129 | $track->(\$about->[1], $depth - 1, $about == $about[-1] ? "$indent " : "$indent| "); |
131 | } |
130 | } |
132 | } else { |
131 | } else { |
133 | $buf .= ".\n"; |
132 | $buf .= ".\n"; |
134 | } |
133 | } |
135 | } |
134 | } |
136 | } else { |
135 | } else { |
137 | $buf .= (" ") x $indent; |
|
|
138 | $buf .= "not found anywhere I looked :(\n"; |
136 | $buf .= "$indent not found anywhere I looked :(\n"; |
139 | } |
137 | } |
140 | } else { |
138 | } else { |
141 | $buf .= (" ") x $indent; |
|
|
142 | $buf .= "not referenced within the search depth.\n"; |
139 | $buf .= "$indent not referenced within the search depth.\n"; |
143 | } |
140 | } |
144 | }; |
141 | }; |
145 | |
142 | |
146 | $buf .= "$ref is\n"; |
143 | $buf .= "$ref is\n"; |
147 | $track->(\$ref, $depth || 10, 1); |
144 | $track->(\$ref, $depth || $ENV{PERL_DEVEL_FINDREF_DEPTH} || 10, ""); |
148 | $buf |
145 | $buf |
149 | } |
146 | } |
150 | |
147 | |
151 | =item @references = Devel::FindRef::find $ref |
148 | =item @references = Devel::FindRef::find $ref |
152 | |
149 | |
… | |
… | |
176 | # we know that HASH(0x176ff70) exists, so turn it into a hashref: |
173 | # we know that HASH(0x176ff70) exists, so turn it into a hashref: |
177 | my $ref_to_hash = Devel::FindRef::ptr2ref 0x176ff70; |
174 | my $ref_to_hash = Devel::FindRef::ptr2ref 0x176ff70; |
178 | |
175 | |
179 | =back |
176 | =back |
180 | |
177 | |
|
|
178 | =head1 ENVIRONMENT VARIABLES |
|
|
179 | |
|
|
180 | You can set the environment variable C<PERL_DEVEL_FINDREF_DEPTH> to an |
|
|
181 | integer to override the default depth in C<track>. If a call explicitly |
|
|
182 | specified a depth it is not overridden. |
|
|
183 | |
181 | =head1 AUTHOR |
184 | =head1 AUTHOR |
182 | |
185 | |
183 | Marc Lehmann <pcg@goof.com>. |
186 | Marc Lehmann <pcg@goof.com>. |
184 | |
187 | |
185 | =head1 BUGS |
188 | =head1 BUGS |