Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error with hash keys beginning with '-' ; second try #67

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dod38fr
Copy link

@dod38fr dod38fr commented Jan 3, 2025

This PR is a retry of PR #51 which targeted the wrong branch and could not be updated.

See #51 for the rationale of this PR.

All the best

Dominique Dumont and others added 2 commits December 16, 2024 17:51
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant