walkingthecow has asked for the wisdom of the Perl Monks concerning the following question:
Written to a YAML file using YAML::XS DumpFile I get something like this:$VAR1 = { 'path' => '/export/home/frank' 'options' => [ { 'value' => '1001', 'param' => 'i' }, { 'param' => 'f' }, { 'value' => 'eyes', 'param' => 'x' }, {}, { 'value' => 'toes', 'param' => 'b' }, { 'param' => 'p' }, ], 'arguments' => [ { 'value' => 'test' } ], };
Rather, I'd like for it to be something like this:arguments: - value: test path: /export/home/frank options: - param: i value: '1001' - param f - param: x value: eyes - flag: b value: toes - param: p
The problem is, I'm not sure what the data structure would look like to create this in YAML. Anyone have any ideas how to do this? I want things to be ordered. First the path, then the options (in order), then the arguments (also in order). But, with the way hashes work, and with YAML's use of dashes for ordering, I cannot seem to accomplish this with DumpFile.path: /export/home/frank options: - param: i value: '1001' - param f - param: x value: eyes - flag: b value: toes - param: p arguments: - value: test
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Keeping Order with YAML::XS
by Loops (Curate) on Jul 29, 2013 at 03:39 UTC | |
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 | |
| |
|
Re: Keeping Order with YAML::XS (impossible, try YAML::Tiny, because no yamltidy)
by Anonymous Monk on Jul 29, 2013 at 04:01 UTC | |
|
Re: Keeping Order with YAML::XS
by tobyink (Canon) on Jul 29, 2013 at 14:21 UTC | |
|
Re: Keeping Order with YAML::XS
by Loops (Curate) on Jul 30, 2013 at 05:01 UTC |