Subject: | Keys are being interpreted as booleans |
YAML::XS is interpreting unquoted keys of "true" and "false" and "null"
as boolean values. For example:
$ perl -wlE 'use YAML::XS; say Dump(Load("{ true: 2, false: 3, null:
4 }"))'
Use of uninitialized value in subroutine entry at -e line 1.
---
'': 4
'1': 2
This becomes a problem if one depends on true.pm.
I don't know if this contravenes the spec to interpret keys as booleans,
presumably it does as there's not much use for it. It's different from
how YAML.pm, YAML::Tiny and JSON::XS do it.
To add complications, YAML::Tiny does not allow quoted keys, so there's
no work around for the major YAML parsers.
Here is a test demonstrating the problem:
{
my $yaml = <<'...';
---
true: 2
false: 4
null: 6
...
my $hash = Load $yaml;
is_deeply $hash, { true => 2, false => 4, null => 6 },
"keys are not interpreted as booleans";
}