Skip Menu |

This queue is for tickets about the YAML-Syck CPAN distribution.

Report information
The Basics
Id: 17411
Status: resolved
Priority: 0/
Queue: YAML-Syck

People
Owner: Nobody in particular
Requestors: stephen [...] jadevine.org.uk
Cc:
AdminCc:

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



Subject: String '~' gets mangled to undef
I have discovered that if a hash value is the string '~' then doing a dump and load will convert into an undef. Here is a test (also attached) which shows the broken behaviour: #!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use YAML::Syck (); my $data = { foo => '~' }; my $yaml = YAML::Syck::Dump($data); my $data2 = YAML::Syck::Load($yaml); is_deeply($data, $data2, '~ should be returned as ~ not undef'); This is causing me quite a bit of trouble so I have marked the bug as 'important'. Thanks, Stephen Quinney
Subject: test.pl
#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use YAML::Syck (); my $data = { foo => '~' }; my $yaml = YAML::Syck::Dump($data); my $data2 = YAML::Syck::Load($yaml); is_deeply($data, $data2, '~ should be returned as ~ not undef');
To add some more information to this bug report, the problem is in the emitter not the parser. Here's an example that shows this: perl -mYAML::Syck -e '$h={foo=>"~"}; print YAML::Syck::Dump($h);' --- foo: ~ That ~ should be quoted in the output otherwise the Load method will read it as meaning undef rather than as a literal string. Stephen Quinney
From: Audrey T.
Thanks, fixed in 0.30.