in reply to Is an SV and IV or a PV or an NV or a UV? How can I tell?
Are you asking what the SV is (NULL, BIND, IV, NV, PV, PVIV, PVNV, PVMG, REGEXP, PVGV, PVLV, PVAV, PVHV, PVCV, PVFM, PVIO), what fields the SV has (IV, NV, PV, GP, etc) or which value is present in the SV (IV, UV, NV, PV, RV, GP, private IV, private NV, private PV, etc)?
For example,
$ perl -MDevel::Peek -E'$_ = 2**31; ++$_; say "value: $_"; Dump $_;' value: 2147483649 SV = PVNV(0x8cc0ac8) at 0x8cebef8 REFCNT = 1 FLAGS = (IOK,POK,pIOK,pPOK,IsUV) UV = 2147483649 NV = 2147483648 PV = 0x8cdf378 "2147483649"\0 CUR = 10 LEN = 12
$_ is a PVNV. It has fields IV*, NV and PV. It has UV and PV values.
I find the last most likely. If so, asking the question is surely due to a bad design decision. A PV, IV, UV and NV of twenty should all be considered the same value. That's why Perl doesn't provide an interface to provide that information in core (although it's trivial for an XS module to access that information).
* — It's called "IV", but Devel::Peek printed "UV" because it currently contains a UV.
|
|---|