Perl-Toolchain-Gang / YAML-Tiny

Read/Write YAML files with as little code as possible

Home Page:http://metacpan.org/release/YAML-Tiny/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parser load list in hash value no matter the indentation.

dod38fr opened this issue · comments

Hi

YAML::Tiny does not parse correctly this YAML:

- foo:
   bar: 
- foo2:
   bar2: {}

It should produce this:

$ perl -MYAML::PP -MData::Dumper -E 'my $data = YAML::PP::LoadFile("test.yml"); say Dumper($data);'
$VAR1 = [
          {
            'foo' => {
                       'bar' => undef
                     }
          },
          {
            'foo2' => {
                        'bar2' => {}
                      }
          }
        ];

But YAML::Tiny store foo2 item in bar value instead of leaving bar undef:

 perl -MYAML::Tiny -MData::Dumper -E 'my $data = YAML::Tiny->read("test.yml"); say Dumper($data);'
$VAR1 = bless( [
                 [
                   {
                     'foo' => {
                                'bar' => [
                                           {
                                             'foo2' => {
                                                         'bar2' => {}
                                                       }
                                           }
                                         ]
                              }
                   }
                 ]
               ], 'YAML::Tiny' );

This was tested on Debian/unstable with:

  • YAML::Tiny 1.73
  • perl 5.32.1

All the best