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: 7146
Status: resolved
Priority: 0/
Queue: YAML

People
Owner: Nobody in particular
Requestors: ybug [...] bereft.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.35
Fixed in: 1.24_001



Subject: scalar with many spaces doesn't round trip
I found a problem round tripping a string containing a large number of spaces: perl -MData::Dumper -MYAML -e '$orig = "A".(" "x200)."B"; $roundtrip = Load Dump $orig; print Dump($orig,$roundtrip); print Dumper([$orig,$roundtrip])' Pipe through cat -A to see the differences. It seems like the loading of flow scalars isn't working right. This is with version 0.35.
Subject: looks like a dump heuristics issue
Reading the YAML spec, it seems that the loading is right but that the block scalar format should be used to preserve whitespace during the dump. It looks like the length > 50 heuristic in _emit_str is what's forcing multiline output and then the "or ($_[0] =~ /^\S[^\n]{76}/m)" condition means it uses folding instead of a block. There doesn't seem to be a way to force block output in this case. Maybe the above regex could have (?!\s) added to the end? Brad
This issue has been copied to: https://github.com/ingydotnet/yaml-pm/issues/40 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.
fixed in 1.24_001