On Tue, 15 Jul 2008 05:01:14 +1000
"Ivan Wills" <[EMAIL PROTECTED]> wrote:

> I would suggest a two modules though say Devel::Refcount

Is this Devel::Refcount really necessary, given how easy it is to build
using B::SV->REFCNT ?

Plus, the more levels of code, the more difficult it is to ensure the
count is correct. Consider

  sub is_1ref
  {
     my ( $object, $name ) = @_;
     my $count = refcount($object);
     ...
  }

vs

  sub is_1ref
  {
     my ( undef, $name ) = @_;
     my $count = refcount($_[0]);
     ...
  }

The $object in the first code creates a second reference, so you have to
subtract 1, whereas the @_ array seems special and doesn't have that
side-effect.

-- 
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