You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When storing a number (e.g. 42) in DBM::Deep, it is retrieved as a string (e.g. "42"). This is generally not a problem unless you generate JSON and pass that onto Javascript which trips on this.
Example code:
use DBM::Deep;
use Devel::Peek;
my$v = 3.14;
my$db = DBM::Deep->new( "foo.db" );
$db->{s} = $v;
my$n_scalar = $v;
my$n_db = $db->{s};
my$n_db_add = $db->{s} + 0.0;
print"=====> Value:\n";
print Dump $n_scalar;
print"=====> Value run through db:\n";
print Dump $n_db;
print"=====> Value after conversion to number again:\n";
print Dump $n_db_add;
resulting in the following output:
SV = NV(0x7faed302d810) at 0x7faed302d828
REFCNT = 1
FLAGS = (NOK,pNOK)
NV = 3.14
=====> Value run through db:
SV = PVNV(0x7faed30034f0) at 0x7faed302d840
REFCNT = 1
FLAGS = (POK,pPOK)
IV = 0
NV = 0
PV = 0x7faed2d5d110 "3.14"\0
CUR = 4
LEN = 10
=====> Value after conversion to number again:
SV = NV(0x7faed302d858) at 0x7faed302d870
REFCNT = 1
FLAGS = (NOK,pNOK)
NV = 3.14
The crucial bit is the NOK in the FLAGS section (IOK for integers, etc.).
The text was updated successfully, but these errors were encountered:
When storing a number (e.g. 42) in DBM::Deep, it is retrieved as a string (e.g. "42"). This is generally not a problem unless you generate JSON and pass that onto Javascript which trips on this.
Example code:
resulting in the following output:
The crucial bit is the NOK in the FLAGS section (IOK for integers, etc.).
The text was updated successfully, but these errors were encountered: