Bug#566822: (Fwd) Re: decode does not behave as documented

Florian Weimer fweimer at bfk.de
Tue Jan 26 08:53:00 UTC 2010


* gregor herrmann:

> And another reply from upstream.
>
> Cheers,
> gregor
>
> From: Marc Lehmann <schmorp at schmorp.de>
> Subject: Re: decode does not behave as documented
> To: gregor herrmann <gregoa at debian.org>
> Date: Mon, 25 Jan 2010 19:56:28 +0100
>
>
> On Mon, Jan 25, 2010 at 07:54:38PM +0100, gregor herrmann <gregoa at debian.org> wrote:
>> this is Debian bug http://bugs.debian.org/566822. Please consider
>> looking into the issue.
>
> this is a bogus bugreport, the submitter fails to understand overloading, see
> "man overload". both documentation and code are correct, the conclusion of
> the submitter is simply bogus.

Upstream fails to understand the side effects of overloading.
Overloading does not make all magic properties go away.  For instance,
the following test fails, too:

use Test::More (tests => 1);
use JSON::XS ();

is_deeply(JSON::XS->new->decode('{"test":true}'), {test => 1});

1;

(If "true" turns into "1", I really expect this test to pass.)

I think this might be more helpful as a documentation:

    "true" becomes JSON::XS::true (equals 1 numerically and as a
    string), "false" becomes JSON::XS::false (equals 0) and "null"
    becomes "undef".

I was specifically looking for something that turns JSON text into
non-blessed Perl objects, and I thought I had found something suitable
because "0" and "1" were explicitly mentioned in the documentation.
(I am aware that you need a mode which uses special references for
booleans to achieve round-trip compatibility.)

-- 
Florian Weimer                <fweimer at bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99





More information about the pkg-perl-maintainers mailing list