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

Comparing Devel-FindRef/README (file contents):
Revision 1.4 by root, Wed Nov 28 12:20:33 2007 UTC vs.
Revision 1.6 by root, Sat Apr 26 03:15:28 2008 UTC

14 to the variables containing them. 14 to the variables containing them.
15 15
16 For example, for this fragment: 16 For example, for this fragment:
17 17
18 package Test; 18 package Test;
19 19
20 our $var = "hi\n"; 20 our $var = "hi\n";
21 my $x = \$var; 21 my $x = \$var;
22 our %hash = (ukukey => \$var); 22 our %hash = (ukukey => \$var);
23 our $hash2 = {ukukey2 => \$var}; 23 our $hash2 = {ukukey2 => \$var};
24 24
25 sub testsub { 25 sub testsub {
26 my $local = $hash2; 26 my $local = $hash2;
27 print Devel::FindRef::track \$var; 27 print Devel::FindRef::track \$var;
28 } 28 }
29 29
30 testsub; 30 testsub;
31 31
32 The output is as follows (or similar to this, in case I forget to update 32 The output is as follows (or similar to this, in case I forget to update
33 the manpage after some changes): 33 the manpage after some changes):
34 34
35 SCALAR(0x676fa0) is 35 SCALAR(0x7bd2d0) is
36 in the global $Test::var.
36 referenced by REF(0x676fb0), which is 37 referenced by REF(0x7bd240), which is
38 in the member 'ukukey2' of HASH(0x7bd228), which is
39 referenced by REF(0x81dae8), which is
40 in the lexical '$local' in CODE(0x81da88), which is
41 in the global &Test::testsub.
42 referenced by REF(0x81da40), which is
43 in the global $Test::hash2.
44 referenced by REF(0x79f3f8), which is
37 in the lexical '$x' in CODE(0x676370), which is 45 in the lexical '$x' in CODE(0x79f518), which is
46 the containing scope for CODE(0x81da88), which is
47 in the global &Test::testsub.
48 referenced by REF(0x79f2f0), which is
38 not found anywhere I looked :( 49 not found anywhere I looked :(
39 referenced by REF(0x676360), which is 50 referenced by REF(0x79f140), which is
40 in the member 'ukukey' of HASH(0x756660), which is 51 in the member 'ukukey' of HASH(0x81d698), which is
41 in the global %Test::hash. 52 in the global %Test::hash.
42 in the global $Test::var.
43 referenced by REF(0x6760e0), which is
44 in the member 'ukukey2' of HASH(0x676f30), which is
45 referenced by REF(0x77bcf0), which is
46 in the lexical '$local' in CODE(0x77bcb0), which is
47 in the global &Test::testsub.
48 referenced by REF(0x77bc80), which is
49 in the global $Test::hash2.
50 53
51 It is a bit convoluted to read, but basically it says that the value 54 It is a bit convoluted to read, but basically it says that the value
52 stored in $var can be found: 55 stored in $var can be found:
53 56
54 - in some variable $x whose origin is not known (I frankly have no idea 57 - in some variable $x whose origin is not known (I frankly have no idea
72 This is the function you most often use. 75 This is the function you most often use.
73 76
74 @references = Devel::FindRef::find $ref 77 @references = Devel::FindRef::find $ref
75 Return arrayrefs that contain [$message, $ref] pairs. The message 78 Return arrayrefs that contain [$message, $ref] pairs. The message
76 describes what kind of reference was found and the $ref is the 79 describes what kind of reference was found and the $ref is the
77 reference itself, which cna be omitted if "find" decided to end the 80 reference itself, which can be omitted if "find" decided to end the
78 search. 81 search. The returned references are all weak references.
79 82
80 The "track" function uses this to find references to the value you 83 The "track" function uses this to find references to the value you
81 are interested in and recurses on the returned references. 84 are interested in and recurses on the returned references.
82 85
83 $ref = Devel::FindRef::ptr2ref $integer 86 $ref = Devel::FindRef::ptr2ref $integer

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines