Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the YAML CPAN distribution.

Report information
The Basics
Id: 82877
Status: resolved
Priority: 0/
Queue: YAML

People
Owner: Nobody in particular
Requestors: hiratara [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.84
Fixed in: 1.20_002



Subject: The trailing NULL value changed into an empty string while loading
Hi. I made a patch with tests to fix this issue. We must set the indent level correctly even if there are no more lines. diff --git a/lib/YAML/Loader.pm b/lib/YAML/Loader.pm index 321293d..53f4830 100644 --- a/lib/YAML/Loader.pm +++ b/lib/YAML/Loader.pm @@ -630,7 +630,10 @@ sub _parse_next_line { $self->die('YAML_EMIT_ERR_BAD_LEVEL') unless defined $offset; shift @{$self->lines}; $self->eos($self->{done} = not @{$self->lines}); - return if $self->eos; + if ($self->eos) { + $self->offset->[$level + 1] = $offset + 1; + return; + } $self->{line}++; # Determine the offset for a new leaf node diff --git a/t/load-works.t b/t/load-works.t index fafb931..f6dcd1c 100644 --- a/t/load-works.t +++ b/t/load-works.t @@ -14,3 +14,9 @@ __DATA__ +++ yaml --- foo: bar +=== empty hashes ++++ perl ++{foo1 => undef, foo2 => undef} ++++ yaml +foo1: +foo2:
This issue has been copied to: https://github.com/ingydotnet/yaml-pm/issues/131 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
Thanks, merged! Will be in next version 1.21