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.3 by root, Thu Jan 11 23:13:37 2007 UTC vs.
Revision 1.4 by root, Fri Jan 12 10:26:55 2007 UTC

19 use Devel::FindRef; 19 use Devel::FindRef;
20 20
21=head1 DESCRIPTION 21=head1 DESCRIPTION
22 22
23Tracking down reference problems (e.g. you expect some object to be 23Tracking down reference problems (e.g. you expect some object to be
24destroyed, but there are still references to it that keep it alive). can 24destroyed, but there are still references to it that keep it alive) can be
25be very hard, although perl keeps track of all values. 25very hard. Fortunately, perl keeps track of all its values, so tracking
26references "backwards" is usually possible.
26 27
27The C<track> function can hlep track down some of those refernces back to 28The C<track> function can help track down some of those references back to
28the variables containing them. 29the variables containing them.
29 30
30For example, for this fragment: 31For example, for this fragment:
31 32
32 package Test; 33 package Test;
41 print Devel::FindRef::track \$var; 42 print Devel::FindRef::track \$var;
42 } 43 }
43 44
44 testsub; 45 testsub;
45 46
46The output is as follows (or similar to htis, in case I forget to update 47The output is as follows (or similar to this, in case I forget to update
47the manpage after some changes): 48the manpage after some changes):
48 49
49 SCALAR(0x676fa0) is 50 SCALAR(0x676fa0) is
50 referenced by REF(0x676fb0), which is 51 referenced by REF(0x676fb0), which is
51 in the lexical '$x' in CODE(0x676370), which is 52 in the lexical '$x' in CODE(0x676370), which is
61 in the global &Test::testsub. 62 in the global &Test::testsub.
62 referenced by REF(0x77bc80), which is 63 referenced by REF(0x77bc80), which is
63 in the global $Test::hash2. 64 in the global $Test::hash2.
64 65
65 66
66It is a bit convoluted to read, but basically it says that the value stored in C<$var> 67It is a bit convoluted to read, but basically it says that the value
67can be found: 68stored in C<$var> can be found:
68 69
69=over 4 70=over 4
70 71
71=item - in some variable C<$x> whose origin is not known (I frankly have no 72=item - in some variable C<$x> whose origin is not known (I frankly have no
72idea why, hints accepted). 73idea why, hints accepted).
166 167
167=head1 BUGS 168=head1 BUGS
168 169
169Only code values, arrays, hashes, scalars and magic are being looked at. 170Only code values, arrays, hashes, scalars and magic are being looked at.
170 171
172This is a quick hack only.
173
171=head1 COPYRIGHT AND LICENSE 174=head1 COPYRIGHT AND LICENSE
172 175
173Copyright (C) 2007 by Marc Lehmann. 176Copyright (C) 2007 by Marc Lehmann.
174 177
175This library is free software; you can redistribute it and/or modify 178This library is free software; you can redistribute it and/or modify

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines