Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Rx CPAN distribution.

Report information
The Basics
Id: 81107
Status: rejected
Priority: 0/
Queue: Data-Rx

People
Owner: Nobody in particular
Requestors: kai.tetzlaff [...] web.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.200002
Fixed in: (no value)



Subject: Did not manage to use data type //bool with YAML document
The validation of the //bool type does not seem to work when using a YAML input document. With the following simple schema: %YAML 1.1 --- type: //rec required: abool: //bool there seems to be no way of creating a valid document. I tried: %YAML 1.1 --- abool: true and replaced true with T, t, 1, ... without success. The result is always: Failed type: found value was not a bool (error: type at $data->{abool})
Subject: Re: [rt.cpan.org #81107] Did not manage to use data type //bool with YAML document
Date: Sun, 11 Nov 2012 10:00:29 -0500
To: "http://kte.myopenid.com/ via RT" <bug-Data-Rx [...] rt.cpan.org>
From: Ricardo Signes <rjbs [...] cpan.org>
* "http://kte.myopenid.com/ via RT" <bug-Data-Rx@rt.cpan.org> [2012-11-11T09:10:03] Show quoted text
> The validation of the //bool type does not seem to work when using a > YAML input document.
What YAML library are you using? -- rjbs
Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #81107] Did not manage to use data type //bool with YAML document
Date: Mon, 12 Nov 2012 09:36:28 +0100
To: bug-Data-Rx [...] rt.cpan.org
From: kai [...] kail.dyndns.org
Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=81107 > > > * "http://kte.myopenid.com/ via RT" <bug-Data-Rx@rt.cpan.org> > [2012-11-11T09:10:03]
>> The validation of the //bool type does not seem to work when using a >> YAML input document.
> > What YAML library are you using?
Ah - sorry for not mentioning this. I'm using the YAML:Any module which, on my system, seems to select YAML:XS/LibYaml as the actual parser backend.
Subject: Re: [rt.cpan.org #81107] Did not manage to use data type //bool with YAML document
Date: Mon, 12 Nov 2012 11:42:59 +0100
To: bug-Data-Rx [...] rt.cpan.org
From: kai [...] kail.dyndns.org
Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=81107 > >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=81107 > >> >> * "http://kte.myopenid.com/ via RT" <bug-Data-Rx@rt.cpan.org> >> [2012-11-11T09:10:03]
>>> The validation of the //bool type does not seem to work when using a >>> YAML input document.
>> >> What YAML library are you using?
> > Ah - sorry for not mentioning this. I'm using the YAML:Any module which, > on my system, seems to select YAML:XS/LibYaml as the actual parser > backend.
I just also tried with the perl version of YAML (use YAML qw(...);) with the same result as reported earlier. I currently don't have YAML::Syck, but could also install it if that helps.
Subject: Re: [rt.cpan.org #81107] Did not manage to use data type //bool with YAML document
Date: Tue, 13 Nov 2012 13:48:43 -0500
To: kai via RT <bug-Data-Rx [...] rt.cpan.org>
From: Ricardo Signes <rjbs [...] cpan.org>
* kai via RT <bug-Data-Rx@rt.cpan.org> [2012-11-12T05:43:16] Show quoted text
> > Ah - sorry for not mentioning this. I'm using the YAML:Any module which, > > on my system, seems to select YAML:XS/LibYaml as the actual parser > > backend.
> I just also tried with the perl version of YAML (use YAML qw(...);) with > the same result as reported earlier. I currently don't have YAML::Syck, > but could also install it if that helps.
Thanks, I will look into this today or tomorrow. -- rjbs
Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

Okay! So, the problem is that unlike JSON, YAML (and other libraries) does nothing to mark the loaded value as a boolean rather than anything else. In other words, "true" becomes a 1. In JSON, it would become an object. Although I have heard it promised that it would be possible to get a boolean object back from YAML, I am not aware of any means to do this. I suggest either using a "//any of [ //bool [any [ //int 0, //int 1 ] ] ]" instead, or writing a replacement //bool that allows 1/0 for perl. This is just one of those places where cross-language stuff gets awkward. Oh. Or you could use JSON. ;) -- rjbs