Skip to content

Empty hashes are put on the previous line in _dump_string() #68

@Corion

Description

@Corion

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 --- .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions