YAML.pm 1.25 Changelog

This release contains a lot of little bug fixes, so I thought I'd blog about it. I hope I didn't break anything but you should be aware that chances are a bit higher than usual. Please test!

At the Perl Toolchain Summit I decided to work on trailing comments for YAML.pm, and then I felt like digging a bit deeper into other bugs.

$YAML::LoadBlessed

YAML::Syck has a $YAML::Syck::LoadBlessed option to disable loading objects. This is important when loading YAML from an untrusted source. I added this to YAML::XS last year, and now also YAML.pm has this option.

See PR 197

Trailing Comments

See my report on the summit where I described the changes.

You should be aware that a trailing <space># became part of the content previously. Make sure you put quotes around such data now.

See also PR 189, PR 190, PR 191

Mapping keys starting with =<space>

Such keys weren't loaded correctly because they were mistaken as special "default" keys.

See PR 194

Scalar = must be quoted

= is a special default key. When dumping a hash with such a key, it must be quoted to be interpreted as normal content.

See PR 202

Multiple regexp roundtrip does not grow

When loading and dumping regexes multiple times, it would grow by putting (?^u:...) around it every time. This bug had been fixed in YAML::XS a while ago.

See PR 203

Fix loading strings with multiple spaces

Top level scalars on the --- line would lose multiple spaces previously:

--- a text    with multiple spaces
--- "also    spaces in quotes were lost"

See PR 172

Support reverse order of block scalar indicators

Previously, only this was allowed:

---
literal: |-1
  text
folded: >-1
  text

Now, according to the spec, also the reverse order is allowed:

---
literal: |1-
  text
folded: >1-
  text

See PR 205

Add support for compact nested block sequences

In YAML, you can nest block sequences on one line. Previously, with YAML.pm you had to use this format:

---
-
  -
    - a
    - b

Now you can use this:

---
- - - a
    - b

See PR 204

Allow more characters in anchor name

See PR 196

Support nested mappings in sequences

YAML.pm supported this partially. What has been working is this:

---
- a: 1
  b: 2

But the following did not work as expected:

---
- .: 1 # was loaded as the string ".: 1"

Also, you can now use explicit keys on the same line:

---
- ? |
    key
  : >
    value

See PR 206

Fix parsing of quoted strings

I changed the parsing because the previously used regex was problematic under certain circumstances.

I actually forgot to add this to the Changes file.

PR 188

Other changes:

  • Remove unused code. See PR 192
  • Use Test::Deep to actually test correctly for class names. See PR 193
  • Disable test with long string under certain conditions. See PR 201

1 Comment

Leave a comment

About tinita

user-pic just another perl punk,