On Tue, 15 Jul 2008 19:16:08 -0700
"Joshua ben Jore" <[EMAIL PROTECTED]> wrote:

>   *Devel::RefCount::refcount = \&Devel::Peek::SvREFCNT;

No it isn't.

Devel::Peek::SvREFCNT counts the refcount of the SV itself that is passed
to it. Mine counts the refcount of the RV contained in a reference value.

As is even printed in the docs:

 This differs from Devel::Peek::SvREFCNT in that SvREFCNT() gives the
 reference count of the SV object itself that it is passed, whereas
 refcount() gives  the count of the object being pointed to. This allows
 it to give the count of any referent (i.e. ARRAY, HASH, CODE, GLOB and
 Regex types) as well.

Consider:

 my $array = [];
 my $otherref = $array;

 Devel::Peek::SvREFCNT($array) => 1
 Devel::Refcount::refcount($array) => 2


-- 
Paul "LeoNerd" Evans

[EMAIL PROTECTED]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Attachment: signature.asc
Description: PGP signature

Reply via email to