You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
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.
YAML
doesn't handle a:
in a comment correctly - it appears to end the comment.YAML::XS
does work correctly.Output:
The text was updated successfully, but these errors were encountered: