develooper Front page | perl.perl5.porters | Postings from December 2004

More B bugs: svref_2object

Thread Next
From:
Alexey Tourbin
Date:
December 7, 2004 15:14
Subject:
More B bugs: svref_2object
Message ID:
20041207231317.GC30266@solemn.turbinal.org
Hello,

Here is a simple script that apparently reveals a bug in B::svref_2object:

#!/usr/bin/perl

use B qw(svref_2object);
use Devel::Peek qw(Dump);

my $v1 = 0.17;
my $v2 = 0.1.7;

sub get_sv {
	my $v = shift;
	my $sv = svref_2object(\$v);
	return $sv;
}

Dump	get_sv($v1);
	get_sv($v2);
Dump	get_sv($v1);

__END__

The output is as follows:

SV = RV(0x806fe4c) at 0x804bfa8
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x804c104
  SV = PVMG(0x80889d8) at 0x804c104
    REFCNT = 1
    FLAGS = (OBJECT,IOK,pIOK)
    IV = 135028824
    NV = 0
    PV = 0
    STASH = 0x806c8b0	"B::NV"
SV = RV(0x806fe4c) at 0x806620c
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x806629c
  SV = PVMG(0x80889f8) at 0x806629c
    REFCNT = 1
    FLAGS = (OBJECT,IOK,pIOK)
    IV = 135028824
    NV = 0
    PV = 0
    STASH = 0x806ca78	"B::PVMG"

So why 0.17 was first B::NV and then got B::PVMG (right after 0.1.7 was
turned into object)?

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About