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.5 by root, Wed Feb 7 21:34:02 2007 UTC vs.
Revision 1.6 by root, Sat Mar 24 19:18:18 2007 UTC

78 78
79=item - in the hash element C<ukukey2>, in the hash in the my variable 79=item - in the hash element C<ukukey2>, in the hash in the my variable
80C<$local> in the sub C<Test::testsub> and also in the hash referenced by 80C<$local> in the sub C<Test::testsub> and also in the hash referenced by
81C<$Test::hash2>. 81C<$Test::hash2>.
82 82
83=back
84
83=head1 EXPORTS 85=head1 EXPORTS
84 86
85None. 87None.
86 88
87=head1 FUNCTIONS 89=head1 FUNCTIONS
100 102
101sub find($); 103sub find($);
102 104
103sub track { 105sub track {
104 my $buf = ""; 106 my $buf = "";
107 my %ignore;
105 108
106 my $track; $track = sub { 109 my $track; $track = sub {
107 my (undef, $depth, $indent) = @_; 110 my ($target, $depth, $indent) = @_;
111 @_ = ();
112 local $ignore{$target+0} = undef;
108 113
109 if ($depth) { 114 if ($depth) {
110 my (@about) = find $_[0]; 115 my (@about) = grep !exists $ignore{$_->[1]}, find $target;
111 if (@about) { 116 if (@about) {
117 local @ignore{map $_->[1]+0, @about} = ();
112 for my $about (@about) { 118 for my $about (@about) {
119 local $ignore{$about+0} = undef;
113 $buf .= (" ") x $indent; 120 $buf .= (" ") x $indent;
114 $buf .= $about->[0]; 121 $buf .= $about->[0];
115 if (@$about > 1) { 122 if (@$about > 1) {
116 $buf .= " $about->[1], which is\n"; 123 $buf .= " $about->[1], which is\n";
117 $track->($about->[1], $depth - 1, $indent + 1); 124 $track->($about->[1], $depth - 1, $indent + 1);
146 153
147=cut 154=cut
148 155
149sub find($) { 156sub find($) {
150 my ($about, $excl) = &find_; 157 my ($about, $excl) = &find_;
151 my %excl = map +($_ => 1), @$excl; 158 my %excl = map +($_ => undef), @$excl;
152 grep !$excl{$_->[1] + 0}, @$about 159 grep !exists $excl{$_->[1] + 0}, @$about
153} 160}
154 161
155=item $ref = Devel::FindRef::ref2ptr $ptr 162=item $ref = Devel::FindRef::ref2ptr $ptr
156 163
157Sometimes you know (from debugging output) the address of a perl scalar 164Sometimes you know (from debugging output) the address of a perl scalar

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines