Subject: | nfreeze -> thaw transforms integer values >= 128 into strings |
===
#!/usr/bin/perl
use warnings;
use strict;
use Devel::Peek;
use Storable qw/nfreeze thaw/;
my $a = [ 127, 128 ];
Dump $a;
print 'x' x 60, "\n";
my $b = Storable::thaw(Storable::nfreeze($a));
Dump $b;
===
prints:
===
SV = RV(0x1820aa4) at 0x180d03c
REFCNT = 1
FLAGS = (PADBUSY,PADMY,ROK)
RV = 0x1801380
SV = PVAV(0x18307e4) at 0x1801380
REFCNT = 1
FLAGS = ()
IV = 0
NV = 0
ARRAY = 0x300c00
FILL = 1
MAX = 1
ARYLEN = 0x0
FLAGS = (REAL)
Elt No. 0
SV = IV(0x18354bc) at 0x1801434
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 127
Elt No. 1
SV = IV(0x18354c0) at 0x1801470
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 128
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SV = RV(0x1820ab8) at 0x1831744
REFCNT = 1
FLAGS = (PADBUSY,PADMY,ROK)
RV = 0x1831894
SV = PVAV(0x1802894) at 0x1831894
REFCNT = 1
FLAGS = ()
IV = 0
NV = 0
ARRAY = 0x305390
FILL = 1
MAX = 3
ARYLEN = 0x0
FLAGS = (REAL)
Elt No. 0
SV = IV(0x18354c4) at 0x180129c
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 127
Elt No. 1
SV = PV(0x1812494) at 0x1809a48
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x30b990 "128"\0
CUR = 3
LEN = 4
===
Note that numeric values >= 128 has no longer an IV and isn't flagged as IOK.
The script produces this output on AIX 5.3 and on Mac OS X 10.4.5 (Darwin 8.5.0).
Tested with Perl versions 5.8.6 (OS X) and 5.8.7 (AIX).
Tested with Storable 2.15.