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

YAML.pm doesn't handle : in comments correctly #220

Open
mscha opened this issue Nov 23, 2020 · 2 comments
Open

YAML.pm doesn't handle : in comments correctly #220

mscha opened this issue Nov 23, 2020 · 2 comments

Comments

@mscha
Copy link

mscha commented Nov 23, 2020

YAML doesn't handle a : in a comment correctly - it appears to end the comment.
YAML::XS does work correctly.

#!/usr/bin/env perl
use 5.024;
use warnings;
use YAML;
use YAML::XS;

my $yaml = <<'YAML';
---
- foo   # test: 123
- bar   # test: 456
YAML

say "YAML $YAML::VERSION";
print YAML::Dump(YAML::Load($yaml));

say '';
say "YAML::XS $YAML::XS::VERSION";
print YAML::XS::Dump(YAML::XS::Load($yaml));

Output:

YAML 1.30
---
- foo: 123
- bar: 456

YAML::XS 0.82
---
- foo
- bar
@perlpunk
Copy link
Collaborator

YAML.pm was one of the first YAML libraries, written for YAML 1.0, and it has many more bugs.
It's unlikely that this is getting fixed, unless you want to give it a try.
I can recommend YAML::PP, I consider it stable as long as you only use the documented frontend API, or YAML::XS if you need something fast.

@mscha
Copy link
Author

mscha commented Nov 23, 2020

I can confirm that YAML::PP does the right thing in this case.
It's a bit unfortunate, though, that the most obvious YAML module for Perl is the buggiest one.

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

No branches or pull requests

2 participants