Subject: | Boolean loaded as string (and thus always becomes true) |
YAML::Parser::Syck 0.01, Syck 0.35 and Syck 0.42, tested on Linux (Redhat 7.3 and Debian Sarge), Perl 5.8.1 and 5.8.4.
Problem: YAML::Parser::Syck (and YAML too, for that matter) loads YAML's Yes/No/true/false into 'Yes'/'No'/'true'/'false' strings, all of which are true in Perl. This creates interoperability problem with Ruby and PHP (and perhaps Python too, but I didn't test Python). Please compare:
$ echo '<? if (!extension_loaded("dl")) dl("syck.so"); print_r(syck_load("a: No\nb: Yes\nc: false\nd: true\n")); ?>'|php -q
Array
(
[a] =>
[b] => 1
[c] =>
[d] => 1
)
$ ruby -ryaml -e'p YAML::load("a: No\nb: Yes\nc: false\nd: true\n")'
{"a"=>false, "b"=>true, "c"=>false, "d"=>true}
$ perl -MYAML::Parser::Syck -MData::Dumper -e'print Dumper(YAML::Parser::Syck::Parse("a: No\nb: Yes\nc: false\nd: true\n"))'
$VAR1 = {
'a' => 'No',
'b' => 'Yes',
'd' => 'true',
'c' => 'false'
};