Bug#601718: libjson-perl: inconsistent handling of numbers

pablobarbachano at yahoo.es pablobarbachano at yahoo.es
Thu Oct 28 22:13:28 UTC 2010


Package: libjson-perl
Version: 2.26-1
Severity: important

- on encode_json(), it seems to remove "" if the string looks like a
  number.  

- on decode_json(), it's inconsistent... given the same object
  (AFAICT), it encodes it differently, although all the time the same
  way. It seems to keep some state in $obj2 that I cannot figure out.

- This is creating a problem with couchdb. couchdb provides an
  attribute 'revpos' as an integer, and it barfs on update if it
  doesn't see it as such


re.pl(main)> $obj1
{
  a => 1,
  b => {
    c => 32
  }
}

re.pl(main)> $ex
{"a":"1","b":{"c":"32"}}

re.pl(main)> my $obj2 = decode_json($ex)
{
  a => 1,
  b => {
    c => 32
  }
}

re.pl(main)> my $dump1 = encode_json($obj1)
{"a":1,"b":{"c":32}}

re.pl(main)> my $dump2 = encode_json($obj2)
{"a":"1","b":{"c":"32"}}

re.pl(main)> cmp_deeply($obj1, $obj2)
ok 3
1


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.28.3-x86_64-linode5 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages libjson-perl depends on:
ii  perl                          5.10.1-15  Larry Wall's Practical Extraction 

Versions of packages libjson-perl recommends:
ii  libjson-xs-perl               2.300-1    module for serializing/deserializi

libjson-perl suggests no packages.

-- no debconf information

-- 





More information about the pkg-perl-maintainers mailing list