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

YAML::Tiny dies parsing its own output because a hash within a list is written improperly

lindleyw opened this issue · comments

This:

use YAML::Tiny; 
$y= YAML::Tiny->new({foo => [7, {x => 3}]}); 
print $y->write_string;

emits this:

---
foo:
  - 7
  -
    x: 3

when it should emit this:

---
foo:
  - 7
  - x: 3

Indeed, this fails with an error failed to classify line:

$y= YAML::Tiny->new({foo => [7, {x => 3}]}); 
$yy=YAML::Tiny->new->read_string($y);

It is surely a problem when YAML::Tiny cannot even parse its own output.

Correction: Unusually formatted output is parsed correctly, mea culpa. Purely an aesthetic issue, no action required.