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.25 by root, Sun Aug 30 14:34:41 2009 UTC vs.
Revision 1.28 by root, Sat Apr 13 06:29:39 2013 UTC

59The output is as follows (or similar to this, in case I forget to update 59The output is as follows (or similar to this, in case I forget to update
60the manpage after some changes): 60the manpage after some changes):
61 61
62 SCALAR(0x7cc888) [refcount 6] is 62 SCALAR(0x7cc888) [refcount 6] is
63 +- referenced by REF(0x8abcc8) [refcount 1], which is 63 +- referenced by REF(0x8abcc8) [refcount 1], which is
64 | in the lexical '$closure_var' in CODE(0x8abc50) [refcount 4], which is 64 | the lexical '$closure_var' in CODE(0x8abc50) [refcount 4], which is
65 | +- the closure created at tst:18. 65 | +- the closure created at tst:18.
66 | +- referenced by REF(0x7d3c58) [refcount 1], which is 66 | +- referenced by REF(0x7d3c58) [refcount 1], which is
67 | | in the lexical '$closure' in CODE(0x7ae530) [refcount 2], which is 67 | | the lexical '$closure' in CODE(0x7ae530) [refcount 2], which is
68 | | +- the containing scope for CODE(0x8ab430) [refcount 3], which is 68 | | +- the containing scope for CODE(0x8ab430) [refcount 3], which is
69 | | | in the global &Test::testsub. 69 | | | the global &Test::testsub.
70 | | +- the main body of the program. 70 | | +- the main body of the program.
71 | +- in the lexical '&' in CODE(0x7ae530) [refcount 2], which was seen before. 71 | +- the lexical '&' in CODE(0x7ae530) [refcount 2], which was seen before.
72 +- referenced by REF(0x7cc7c8) [refcount 1], which is 72 +- referenced by REF(0x7cc7c8) [refcount 1], which is
73 | in the lexical '$global_my' in CODE(0x7ae530) [refcount 2], which was seen before. 73 | the lexical '$global_my' in CODE(0x7ae530) [refcount 2], which was seen before.
74 +- in the global $Test::var. 74 +- the global $Test::var.
75 +- referenced by REF(0x7cc558) [refcount 1], which is 75 +- referenced by REF(0x7cc558) [refcount 1], which is
76 | in the member 'ukukey2' of HASH(0x7ae140) [refcount 2], which is 76 | the member 'ukukey2' of HASH(0x7ae140) [refcount 2], which is
77 | +- referenced by REF(0x8abad0) [refcount 1], which is 77 | +- referenced by REF(0x8abad0) [refcount 1], which is
78 | | in the lexical '$testsub_local' in CODE(0x8ab430) [refcount 3], which was seen before. 78 | | the lexical '$testsub_local' in CODE(0x8ab430) [refcount 3], which was seen before.
79 | +- referenced by REF(0x8ab4f0) [refcount 1], which is 79 | +- referenced by REF(0x8ab4f0) [refcount 1], which is
80 | in the global $Test::global_hashref. 80 | the global $Test::global_hashref.
81 +- referenced by REF(0x7ae518) [refcount 1], which is 81 +- referenced by REF(0x7ae518) [refcount 1], which is
82 | in the member 'ukukey' of HASH(0x7d3bb0) [refcount 1], which is 82 | the member 'ukukey' of HASH(0x7d3bb0) [refcount 1], which is
83 | in the global %Test::global_hash. 83 | the global %Test::global_hash.
84 +- referenced by REF(0x7ae2f0) [refcount 1], which is 84 +- referenced by REF(0x7ae2f0) [refcount 1], which is
85 a temporary on the stack. 85 a temporary on the stack.
86 86
87It is a bit convoluted to read, but basically it says that the value 87It is a bit convoluted to read, but basically it says that the value
88stored in C<$var> is referenced by: 88stored in C<$var> is referenced by:
197 grep !($#$_ && exists $excl{ref2ptr $_->[1]}), @$about 197 grep !($#$_ && exists $excl{ref2ptr $_->[1]}), @$about
198} 198}
199 199
200=item $ref = Devel::FindRef::ptr2ref $integer 200=item $ref = Devel::FindRef::ptr2ref $integer
201 201
202Sometimes you know (from debugging output) the address of a perl scalar 202Sometimes you know (from debugging output) the address of a perl value you
203you are interested in (e.g. C<HASH(0x176ff70)>). This function can be used 203are interested in (e.g. C<HASH(0x176ff70)>). This function can be used to
204to turn the address into a reference to that scalar. It is quite safe to 204turn the address into a reference to that value. It is quite safe to call
205call on valid addresses, but extremely dangerous to call on invalid ones. 205on valid addresses, but extremely dangerous to call on invalid ones. I<No
206checks whatsoever will be done>, so don't use this unless you really know
207the value is the address of a valid perl value.
206 208
207 # we know that HASH(0x176ff70) exists, so turn it into a hashref: 209 # we know that HASH(0x176ff70) exists, so turn it into a hashref:
208 my $ref_to_hash = Devel::FindRef::ptr2ref 0x176ff70; 210 my $ref_to_hash = Devel::FindRef::ptr2ref 0x176ff70;
209 211
210=item $ref = Devel::FindRef::ref2ptr $reference 212=item $ptr = Devel::FindRef::ref2ptr $reference
211 213
212The opposite of C<ptr2ref>, above: returns the internal address of the 214The opposite of C<ptr2ref>, above: returns the internal address of the
213value pointed to by the passed reference. I<No checks whatsoever will be 215value pointed to by the passed reference. This function is safe to call on
214done>, so don't use this. 216anything, and returns the same value taht a normal reference would if used
217in a numeric context.
215 218
216=back 219=back
217 220
218=head1 ENVIRONMENT VARIABLES 221=head1 ENVIRONMENT VARIABLES
219 222

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines