Selasa, 17 November 2009

Merge key support in YAML

None of the many Perl YAML modules support merge key:

$ cat merge.yaml
foo: 1
bar: 2
<<:
baz: 3

$ perl -MYAML::Tiny -MFile::Slurp -e'print Dump Load(scalar read_file "merge.yaml")'
---
<<:
baz: 3
bar: 2
foo: 1

$ perl -MYAML -MFile::Slurp -e'print Dump Load(scalar read_file "merge.yaml")'
---
<<:
baz: 3
bar: 2
foo: 1

$ perl -MYAML::Syck -MFile::Slurp -e'print Dump Load(scalar read_file "merge.yaml")'
---
<<:
baz: 3
bar: 2
foo: 1

$ perl -MYAML::XS -MFile::Slurp -e'print Dump Load(scalar read_file "merge.yaml")'
---
<<:
baz: 3
bar: 2
foo: 1


However, good ol' Ruby handles it just fine:

$ ruby -ryaml -e'print YAML::load(File.open("merge.yaml").read).to_yaml'
---
baz: 3
foo: 1
bar: 2


Kinda strange since Ruby's yaml and YAML::Syck both use why's syck library, which has not been updated for quite a while.

1 komentar:

  1. Well, reading YAML::Syck's ticket replies it seems that Ruby's version of syck and YAML::Syck's version of syck are somewhat different.

    BalasHapus

Catatan: Hanya anggota dari blog ini yang dapat mengirim komentar.