|
From: Johan H. <hol...@ia...> - 2006-06-07 12:52:08
|
Hi!
I've been using YAML in both Perl and Ruby without any problem. But
recently I tried to mix the two languages, and let both work on the the
same YAML-files. As far as I can see, a string that happens to consist
of only integers "looses" its type when it is handled by Perl. For example:
$ cat example.yaml
---
- 11
- "22"
- foo
$
$ perl -MYAML -00 -e 'print Dump Load <>' example.yaml
--- #YAML:1.0
- 11
- 22
- foo
$
$ ruby -rYAML -e 'print YAML.load(ARGF.read).to_yaml' example.yaml
---
- 11
- "22"
- foo
In the Perl case above the "22" is transformed into a number 22.
I'm aware of Perl's indifference and on-the-fly conversion between
numbers and strings. But I had still hoped that YAML for Perl would have
left a string looking like a number as it was (like Data::Dumper in Perl
does).
Is there some way of configuring YAML for Perl to do what I want,
or is it impossible to this behavior?
Regards,
Johan Holmberg
|