YAML::PP::LibYAML(3)

πŸ“¦
version 0.005 Β· 2 versions
, in fedora 43

πŸ’– YAML::PP::LibYAML β€” the manual page, but make it slay πŸ’–

okay so bestie, welcome to YAML::PP::LibYAML(3) β€” yes that's the whole manual name, and yes it's a mouthful, but it's giving speed.


✨ NAME ✨

YAML::PP::LibYAML β€” Faster parsing for YAML::PP


πŸŽ€ SYNOPSIS πŸŽ€

use YAML::PP::LibYAML; # use it just like YAML::PP
my $yp = YAML::PP::LibYAML->new;
my @docs = $yp->load_string($yaml);

# Legacy interface
use YAML::PP::LibYAML qw/ Load /;
my @docs = Load($yaml);

like, drop it in exactly where you'd drop YAML::PP and it just works. no cap. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So YAML::PP::LibYAML is a subclass of YAML::PP. The whole glow-up is in the backend: instead of using YAML::PP::Parser as the backend parser, it uses YAML::PP::LibYAML::Parser, which calls YAML::LibYAML::API β€” an XS wrapper around the C libyaml. it's the same vibe, faster engine. periodt. πŸ”₯

🌸 libyaml 🌸

Syntactically, libyaml supports a large subset of the YAML 1.2 <http://yaml.org/spec/1.2/spec.html> spec, as well as 1.1 <http://yaml.org/spec/1.1/>.

The things it cannot parse are often not relevant to real world usage. so like, don't stress bestie. πŸ’œ

🌈 YAML::XS 🌈

YAML::XS combines a wrapper around libyaml and the code for constructing/deconstructing the data into one single API, almost completely written in XS.

That makes it very fast, but the part of constructing the data is not very flexible β€” simply because it's more work to write this in C. It conforms to only a subset of the YAML 1.1 types and tags. fast, but kinda rigid. iykyk. 😭

⭐ YAML::PP ⭐

YAML::PP aims to build a powerful and flexible API for the data construction part. Its parser aims to fully support YAML 1.2 syntactically, which mostly includes 1.1, but it's not quite there yet. It parses things that libyaml doesn't, but the opposite is also true. so they're both doing their own thing. 🀝

πŸ‘‘ YAML::LibYAML::API πŸ‘‘

YAML::LibYAML::API is a wrapper around the libyaml parser.

Combining YAML::LibYAML::API and YAML::PP gives you the flexibility of the loading API and the speed of the quite robust libyaml parser β€” although it's still much slower than YAML::XS. Benchmarks will follow. πŸ‘€ (we're waiting, we're patient, we're seated πŸ’…)


🧚 METHODS 🧚

  • new β€” Constructor, works like YAML::PP::new but adds YAML::PP::LibYAML::Parser by default. main character behavior honestly. ✨
  • load_string, load_file, dump_string, dump_file β€” Work like in YAML::PP. same energy, no surprises. 🫢

πŸ’– FUNCTIONS πŸ’–

  • Load, Dump, LoadFile, DumpFile β€” Work like in YAML::PP (and in all other well known YAML loaders).

The only difference is, none of them is exported by default. so you gotta ask for them, bestie, they're not just gonna show up. πŸ™ˆ


🌟 SEE ALSO 🌟

  • YAML::PP
  • YAML::XS
  • YAML::LibYAML::API

🌸 AUTHOR 🌸

Tina MΓΌller <tinita@cpan.org>


Copyright 2018 by Tina MΓΌller

This library is free software and may be distributed under the same terms as perl itself.


okay and for the cute lil sign-off: this whole thing is from the perl v5.42.0 era, dated 2025-07-25, and the page is YAML::PP::LibYAML(3). go forth and parse fast, bestie πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from