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

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

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Hash keys are not always escaped
Try the following: %Hash = ( 'AVE,' => { '??' => { '?? => 1 } } ); DumpFile( "file.yml", \%Hash ); $hashref = LoadFile( "file.yml" ); YAML is not escaping 'AVE,' by putting quotes around it, so there's an error. If I manually edit the file to put single quotes around it, it works.
From: jcullin [...] unipress.com
I just ran into the same problem. I see that I can easily fix it by changing one line in sub _parse_inline_simple (I'm using version 0.35): sub _parse_inline_simple { my $value; if ($o->{inline} =~ /^(|[^!@#%^&*].*?)(?=[,[\]{}]|: |- |:\s*$|$)/) { If I remove the comma from the regex it works for me. Will this break other things? Is there a better way to fix it (like quoting the key when the file is written)? (I see that version 0.38 was just released, but I'm afraid to upgrade just yet because I'm using the same code with a lot of yaml files on a lot of different machines, and I've made other minor fixes to YAML.pm in the past.) Thanks. -Joe