in reply to Keeping Order with YAML::XS
Since you know what you're aiming at, just use the yaml as a template. Load it into Perl and then dump the resulting data structure:
Produces:use YAML::XS qw(LoadFile); use Data::Dump qw(pp); pp LoadFile(\*DATA); __DATA__ path: /export/home/frank options: - param: i value: '1001' - param f - param: x value: eyes - flag: b value: toes - param: p arguments: - value: test
{ arguments => [{ value => "test" }], options => [ { param => "i", value => 1001 }, "param f", { param => "x", value => "eyes" }, { flag => "b", value => "toes" }, { param => "p" }, ], path => "/export/home/frank", }
Which after looking back at your original post, is essentially the same as your input (which has a missing comma). So its not a matter of finding a data structure that produces your desired YAML. Maybe it's better to have asked why you want a specific format to your YAML? Isn't any format that properly encodes your data, okay?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Keeping Order with YAML::XS
by walkingthecow (Friar) on Jul 29, 2013 at 05:46 UTC | |
by Loops (Curate) on Jul 29, 2013 at 06:20 UTC | |
by walkingthecow (Friar) on Jul 29, 2013 at 08:08 UTC | |
by Corion (Patriarch) on Jul 29, 2013 at 08:10 UTC | |
by Loops (Curate) on Jul 29, 2013 at 09:40 UTC | |
by Anonymous Monk on Jul 29, 2013 at 09:44 UTC | |
|