ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Devel-FindRef/FindRef.pm
(Generate patch)

Comparing Devel-FindRef/FindRef.pm (file contents):
Revision 1.17 by root, Wed Nov 19 07:36:40 2008 UTC vs.
Revision 1.18 by root, Mon Dec 1 13:22:43 2008 UTC

104 104
105=cut 105=cut
106 106
107sub find($); 107sub find($);
108 108
109sub _f($) {
110 "$_[0] [refcount " . (_refcnt $_[0]) . "]"
111}
112
109sub track { 113sub track {
110 my ($ref, $depth) = @_; 114 my ($ref, $depth) = @_;
111 @_ = (); 115 @_ = ();
112 116
113 my $buf = ""; 117 my $buf = "";
123 if (@about) { 127 if (@about) {
124 for my $about (@about) { 128 for my $about (@about) {
125 $buf .= "$indent" . (@about > 1 ? "+- " : " ") . $about->[0]; 129 $buf .= "$indent" . (@about > 1 ? "+- " : " ") . $about->[0];
126 if (@$about > 1) { 130 if (@$about > 1) {
127 if ($seen{ref2ptr $about->[1]}++) { 131 if ($seen{ref2ptr $about->[1]}++) {
128 $buf .= " $about->[1], which was seen before.\n"; 132 $buf .= " " . (_f $about->[1]) . ", which was seen before.\n";
129 } else { 133 } else {
130 $buf .= " $about->[1], which is\n"; 134 $buf .= " " . (_f $about->[1]) . ", which is\n";
131 $track->(\$about->[1], $depth - 1, $about == $about[-1] ? "$indent " : "$indent| "); 135 $track->(\$about->[1], $depth - 1, $about == $about[-1] ? "$indent " : "$indent| ");
132 } 136 }
133 } else { 137 } else {
134 $buf .= ".\n"; 138 $buf .= ".\n";
135 } 139 }
140 } else { 144 } else {
141 $buf .= "$indent not referenced within the search depth.\n"; 145 $buf .= "$indent not referenced within the search depth.\n";
142 } 146 }
143 }; 147 };
144 148
145 $buf .= "$ref is\n"; 149 $buf .= (_f $ref) . " is\n";
146 $track->(\$ref, $depth || $ENV{PERL_DEVEL_FINDREF_DEPTH} || 10, ""); 150 $track->(\$ref, $depth || $ENV{PERL_DEVEL_FINDREF_DEPTH} || 10, "");
147 $buf 151 $buf
148} 152}
149 153
150=item @references = Devel::FindRef::find $ref 154=item @references = Devel::FindRef::find $ref

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines