Subject: | YAML::Tiny >=1.60 generates certain(?) strings without quotes |
Date: | Fri, 8 Aug 2014 10:18:02 +0200 |
To: | bug-YAML-Tiny [...] rt.cpan.org |
From: | Michael Prokop <mprokop [...] sipwise.com> |
Hi!
I noticed a parsing problem with a YAML file which is caused by the way
YAML::Tiny generates the YAML file since recent versions.
Minimized demo code:
% cat demo.pl
#!/usr/bin/perl
use strict;
use warnings;
use YAML::Tiny;
my $yaml = YAML::Tiny->new;
my $outputfile = shift;
$yaml->[0]->{foo} = '^00|\+([1-9][0-9]+)$';
open(my $fh, '>', "$outputfile");
print $fh $yaml->write_string();
Now that's what's working as expected with older versions:
% dpkg --list libyaml-tiny-perl | grep '^ii'
ii libyaml-tiny-perl 1.56-1 all Perl module for reading and writing YAML files
% perl ./demo.pl demo.yml
% cat demo.yml
---
foo: '^00|\+([1-9][0-9]+)$'
But at least since YAML::Tiny v1.60 (verified with 1.60 + 1.63) it's
generating unexpected output WRT the quoting:
% dpkg --list libyaml-tiny-perl | grep '^ii'
ii libyaml-tiny-perl 1.63-1 all Perl module for reading and writing YAML files
% perl ./demo.pl demo.yml
% cat demo.yml
---
foo: ^00|\+([1-9][0-9]+)$
Notice the missing quotes around the '^00...' string in its output.
Is this expected behaviour? If so, is there any way how to still get
the quotes so the file can be further processed without breaking?
System environment: Perl v5.18.2 on Debian/jessie (amd64)
Thanks!
regards,
-mika-
Message body not shown because it is not plain text.