On Wed, Jan 27, 2010 at 10:06:39AM -0800, Robert Stone wrote: > On Wed, Jan 27, 2010 at 12:31:44PM +0200, Niko Tyni wrote: > > > > Sorry for the lack of action on this. > > No problem at all, thanks for looking into this. > > > > What's wrong with Devel::Peek:SvREFCNT(\%m) ? > > "\%m" is a reference constructor, so SvREFCNT() ends up > reporting the reference count of that newly constructed SV. The > situation can be illustrated with this small script: > > #!/usr/bin/perl > use strict; > use warnings; > use Devel::Peek; > my %m = (a => 'b'); > my $mr = \%m; > Devel::Peek::Dump($mr); > print Devel::Peek::SvREFCNT(\%m), "\n"; > > From the Dump you can see that %m (the PVHV) has a refcount of > 2, but "Devel::Peek::SvREFCNT(\%m)" reports 1. The reason for this can > be illustrated by breaking that call up a little bit. One would > normally expect that: > > Devel::Peek::SvREFCNT(\%m) > > should be equivalent to > > my $tmp = \%m; > Devel::Peek::SvREFCNT($tmp) > > which unsurprisingly reports a refcount of 1 for $tmp. Nothing changes > when $tmp is an immediate, unlabeled value on the argument stack to > SvREFCNT() and I think that's expected and correct behavior. > > The proposed patch solves this difficulty by always passing the > argument from Perl by reference and then unconditionally dereferencing > to access the target value.
Hi Robert, Sorry for the delay in pointing this, but I forwarded this to the upstream bug tracker and various people are discussing a fix. https://rt.perl.org/rt3//Ticket/Display.html?id=117793 Cheers, Dominic. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org