Skip Menu |

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 58609
Status: rejected
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: docs of refaddr()
Date: Wed, 23 Jun 2010 10:00:05 +1000
To: bug-Scalar-List-Utils [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
At the risk of showing my ignorance, for a long time I didn't quite realize refaddr() was the same as numizing but the point of it is to bypass overloading. It might be worth a couple of words in the docs to make that clear, and also perhaps a bit about what can be assumed about an address: =item refaddr EXPR If EXPR evaluates to a reference then return the internal memory address of the thing referred to by EXPR. Otherwise return C<undef>. $addr = refaddr "string"; # undef $addr = refaddr \$var; # eg 12345678 $addr = refaddr []; # eg 23456784 $obj = bless {}, "Foo"; $addr = refaddr $obj; # eg 88123488 The address is the same as using a reference numerically C<$ref+0> per L<perlref/Using References>, but C<refaddr> by-passes any overloaded numizing a blessed reference might have from L<overload>. The address of a target thing is constant and no two things have the same address, though an address may be re-used after the thing is destroyed.