Subject: | Number vs. string heuristics for dump |
YAML's dump method doesn't respect the string vs. number status of a scalar. This matters for version numbers, where trailing zeros may be relevent. E.g., META.yml files can be parsed incorrectly. Example code:
--------------------
use YAML;
use Data::Dumper;
my $n = { version => "1.10" };
my $n2 = YAML::Load(YAML::Dump($n));
print Data::Dumper->Dump([$n],["original"]);
print Data::Dumper->Dump([$n2],["YAMLfied"]);
--------------------
Output of this code:
--------------------
$original = {
'version' => '1.10'
};
$YAMLfied = {
'version' => '1.1'
};
--------------------
dump() should look at whether Perl thinks a scalar is a string or a number and, if a string, quote it.