… | |
… | |
4 | SYNOPSIS |
4 | SYNOPSIS |
5 | use Devel::FindRef; |
5 | use Devel::FindRef; |
6 | |
6 | |
7 | DESCRIPTION |
7 | DESCRIPTION |
8 | Tracking down reference problems (e.g. you expect some object to be |
8 | Tracking down reference problems (e.g. you expect some object to be |
9 | destroyed, but there are still references to it that keep it alive). can |
9 | destroyed, but there are still references to it that keep it alive) can |
10 | be very hard, although perl keeps track of all values. |
10 | be very hard. Fortunately, perl keeps track of all its values, so |
|
|
11 | tracking references "backwards" is usually possible. |
11 | |
12 | |
12 | The "track" function can hlep track down some of those refernces back to |
13 | The "track" function can help track down some of those references back |
13 | the variables containing them. |
14 | to the variables containing them. |
14 | |
15 | |
15 | For example, for this fragment: |
16 | For example, for this fragment: |
16 | |
17 | |
17 | package Test; |
18 | package Test; |
18 | |
19 | |
… | |
… | |
26 | print Devel::FindRef::track \$var; |
27 | print Devel::FindRef::track \$var; |
27 | } |
28 | } |
28 | |
29 | |
29 | testsub; |
30 | testsub; |
30 | |
31 | |
31 | The output is as follows (or similar to htis, in case I forget to update |
32 | The output is as follows (or similar to this, in case I forget to update |
32 | the manpage afetr some changes): |
33 | the manpage after some changes): |
33 | |
34 | |
34 | SCALAR(0x676fa0) is |
35 | SCALAR(0x676fa0) is |
35 | referenced by REF(0x676fb0), which is |
36 | referenced by REF(0x676fb0), which is |
36 | in the lexical '$x' in CODE(0x676370), which is |
37 | in the lexical '$x' in CODE(0x676370), which is |
37 | not found anywhere I looked :( |
38 | not found anywhere I looked :( |
… | |
… | |
91 | |
92 | |
92 | BUGS |
93 | BUGS |
93 | Only code values, arrays, hashes, scalars and magic are being looked |
94 | Only code values, arrays, hashes, scalars and magic are being looked |
94 | at. |
95 | at. |
95 | |
96 | |
|
|
97 | This is a quick hack only. |
|
|
98 | |
96 | COPYRIGHT AND LICENSE |
99 | COPYRIGHT AND LICENSE |
97 | Copyright (C) 2007 by Marc Lehmann. |
100 | Copyright (C) 2007 by Marc Lehmann. |
98 | |
101 | |
99 | This library is free software; you can redistribute it and/or modify |
102 | This library is free software; you can redistribute it and/or modify |
100 | it under the same terms as Perl itself, either Perl version 5.8.8 |
103 | it under the same terms as Perl itself, either Perl version 5.8.8 |