Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix error with hash keys beginning with '-'
YAML::Tiny fails to parse a hash where the key beigns with '-' (e.g. '-foo') with the error: YAML::Tiny found illegal characters in plain scalar: 'family: 'Courier 10 Pitch'' at test-yaml.pl line 21. Here's an example below, with a test program, the yaml file written by the test program and the result of the script: $ cat test-yaml.pl use strict; use warnings; use YAML::Tiny; use XXX; my $data = { '-weight' => 'normal', '-overstrike' => 0, '-size' => -13, '-slant' => 'roman', '-underline' => 0, '-family' => 'Courier 10 Pitch' }; my $config_file= 'test.yml'; my $config_yaml = YAML::Tiny->new ( { font => $data } ); $config_yaml->write($config_file); my $new_config = YAML::Tiny->read($config_file) ; YYY $new_config; devel$ cat test.yml --- font: -family: 'Courier 10 Pitch' -overstrike: 0 -size: -13 -slant: roman -underline: 0 -weight: normal devel$ perl test-yaml.pl YAML::Tiny found illegal characters in plain scalar: 'family: 'Courier 10 Pitch'' at test-yaml.pl line 21.
- Loading branch information