… | |
… | |
59 | - in the hash element "ukukey2", in the hash in the my variable $local |
59 | - in the hash element "ukukey2", in the hash in the my variable $local |
60 | in the sub "Test::testsub" and also in the hash referenced by |
60 | in the sub "Test::testsub" and also in the hash referenced by |
61 | $Test::hash2. |
61 | $Test::hash2. |
62 | |
62 | |
63 | EXPORTS |
63 | EXPORTS |
64 | None. |
64 | None. |
65 | |
65 | |
66 | FUNCTIONS |
66 | FUNCTIONS |
67 | $string = Devel::FindRef::track $ref[, $depth] |
67 | $string = Devel::FindRef::track $ref[, $depth] |
68 | Track the perl value pointed to by $ref up to a depth of $depth |
68 | Track the perl value pointed to by $ref up to a depth of $depth and |
69 | and return a descriptive string. $ref can point at any perl |
69 | return a descriptive string. $ref can point at any perl value, be it |
70 | value, be it anonymous sub, hash, array, scalar etc. |
70 | anonymous sub, hash, array, scalar etc. |
71 | |
71 | |
72 | This is the function you most often use. |
72 | This is the function you most often use. |
73 | |
73 | |
74 | @references = Devel::FindRef::find $ref |
74 | @references = Devel::FindRef::find $ref |
75 | Return arrayrefs that contain [$message, $ref] pairs. The |
75 | Return arrayrefs that contain [$message, $ref] pairs. The message |
76 | message describes what kind of reference was found and the $ref |
76 | describes what kind of reference was found and the $ref is the |
77 | is the reference itself, which cna be omitted if "find" decided |
77 | reference itself, which cna be omitted if "find" decided to end the |
78 | to end the search. |
78 | search. |
79 | |
79 | |
80 | The "track" function uses this to find references to the value |
80 | The "track" function uses this to find references to the value you |
81 | you are interested in and recurses on the returned references. |
81 | are interested in and recurses on the returned references. |
82 | |
82 | |
83 | $ref = Devel::FindRef::ref2ptr $ptr |
83 | $ref = Devel::FindRef::ptr2ref $integer |
84 | Sometimes you know (from debugging output) the address of a perl |
84 | Sometimes you know (from debugging output) the address of a perl |
85 | scalar you are interested in. This function can be used to turn |
85 | scalar you are interested in (e.g. "HASH(0x176ff70)"). This function |
86 | the address into a reference to that scalar. It is quite safe to |
86 | can be used to turn the address into a reference to that scalar. It |
87 | call on valid addresses, but extremely dangerous to call on |
87 | is quite safe to call on valid addresses, but extremely dangerous to |
88 | invalid ones. |
88 | call on invalid ones. |
|
|
89 | |
|
|
90 | # we know that HASH(0x176ff70) exists, so turn it into a hashref: |
|
|
91 | my $ref_to_hash = Devel::FindRef::ptr2ref 0x176ff70; |
89 | |
92 | |
90 | AUTHOR |
93 | AUTHOR |
91 | Marc Lehmann <pcg@goof.com>. |
94 | Marc Lehmann <pcg@goof.com>. |
92 | |
95 | |
93 | BUGS |
96 | BUGS |
94 | Only code values, arrays, hashes, scalars and magic are being looked |
97 | Only code values, arrays, hashes, scalars and magic are being looked at. |
95 | at. |
|
|
96 | |
98 | |
97 | This is a quick hack only. |
99 | This is a quick hack only. |
98 | |
100 | |
99 | COPYRIGHT AND LICENSE |
101 | COPYRIGHT AND LICENSE |
100 | Copyright (C) 2007 by Marc Lehmann. |
102 | Copyright (C) 2007 by Marc Lehmann. |
101 | |
103 | |
102 | This library is free software; you can redistribute it and/or modify |
104 | This library is free software; you can redistribute it and/or modify it |
103 | it under the same terms as Perl itself, either Perl version 5.8.8 |
105 | under the same terms as Perl itself, either Perl version 5.8.8 or, at |
104 | or, at your option, any later version of Perl 5 you may have |
106 | your option, any later version of Perl 5 you may have available. |
105 | available. |
|
|
106 | |
107 | |