From: _why Date: 2007-01-09T07:50:26+09:00 Subject: Re: incorrect yaml? On Tue, Jan 09, 2007 at 06:37:20AM +0900, Dan Kirkwood wrote: > This does *not* load in to the yaml module in Perl (changed to a > one-liner for brevity): > ruby -ryaml -e 'puts ({%{foo} => %w[a b c]}).to_yaml' | perl -MYAML > -0777 -e 'YAML::Load(<>)' > YAML Error: Invalid element in map > Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT > Line: 3 > > Converting a similar structure using Perl produces yaml with the list > indented. My question is: which implementation is correct? Should the > a,b,c list be indented? The Ruby output is read properly by Ruby, but > not Perl. The Perl output is read properly by both. Ruby's YAML support is further along than YAML.pm. The YAML generated by Ruby's YAML module is correct for YAML 1.0. YAML.pm just doesn't know how to parse it. See example 4.19 in the spec[1]. You might try Audrey Tang's YAML::Syck[2], which uses the same backend as Ruby, thus is more likely to play nice with each other. Signed with a very pricey horsehair brush, _why [1] http://yaml.org/spec/history/2004-01-29/2004-01-29.html#id2564419 [2] http://search.cpan.org/dist/YAML-Syck/