Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the perl representation of false #47

Closed
le-garff-yoann opened this issue Apr 2, 2016 · 1 comment
Closed

Question about the perl representation of false #47

le-garff-yoann opened this issue Apr 2, 2016 · 1 comment

Comments

@le-garff-yoann
Copy link

Is it possible to ensure that the parser translates false into 0 instead of an empty string ?

@le-garff-yoann le-garff-yoann changed the title Quetion about the internal representation of false Quetion about the perl representation of false Apr 2, 2016
@le-garff-yoann le-garff-yoann changed the title Quetion about the perl representation of false Question about the perl representation of false Apr 7, 2016
@perlpunk
Copy link
Collaborator

The empty string is perl's default false value, so I don't think there will be an option to support 0.

Starting with YAML::XS 0.66_001, you can use this:

local $YAML::XS::Boolean = "JSON::PP"; # or "boolean"
my $data = Load("booltrue: true");
$data->{boolfalse} = JSON::PP::false;
my $yaml = Dump($data);
# boolfalse: false
# booltrue: true

See more about this in the docs. Maybe this helps you as the string value of JSON::PP::Boolean and boolean.pm false objects is 0.

I will close this issue when YAML::XS 0.67 is released, unless there are further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants