YAML.pm 1.25 Changelog

综合技术 2018-05-12 阅读原文

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 myreport on the
summit where I described the changes.

You should be aware that a trailing #
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 =

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
blogs.perl.org

责编内容by:blogs.perl.org阅读原文】。感谢您的支持!

您可能感兴趣的

Issue #9: 10 Reads, A Handcrafted Weekly Newslette... Hey y’all, Here are 10 reads I thought were worth sharing this week. The t...
Plait.py – a fake data modeler plait.py plait.py is a program for generating fake data from composable yaml t...
Service Mesh实践之Istio初体验 微服务国内发展背景 2014年,Martin Fowler撰写的《Microservices》使得许多国内的先行者接触到微服务这个概念并将其引入国内,201...
Airship: Making life cycle management repeatable a... Although the name brings to mind a dirigible, Airship is a actually collection ...
Parsing Config Files The Right Way First published on my blogParsing configuration files is something ...