The following program creates invalid output:
#!perl
use 5.020;
use YAML::Tiny 'Dump';
say Dump {};
__END__
--- {}
This happens because in _dump_string , the line gets appended indiscriminately to the document delimiter:
...
} elsif ( ref $cursor eq 'HASH' ) {
unless ( %$cursor ) {
$lines[-1] .= ' {}';
next;
}
push @lines, $self->_dump_hash( $cursor, $indent, {} );
I don't know what a good fix would be here. Maybe explicitly checking that we are not appending to the line --- .