The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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);

DESCRIPTION

YAML::PP::LibYAML is a subclass of YAML::PP. Instead of using YAML::PP::Parser as a the backend parser, it uses YAML::PP::LibYAML::Parser which calls YAML::LibYAML::API, an XS wrapper around the C libyaml.

libyaml

Syntactically libyaml supports a large subset of the YAML 1.2 spec as well as 1.1.

The things it cannot parse are often not relevant to real world usage.

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.

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.

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.

METHODS

new

Constructor, works like YAML::PP::new but adds YAML::PP::LibYAML::Parser by default.

load_string, load_file, dump_string, dump_file

Work like in YAML::PP

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.

SEE ALSO

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

AUTHOR

Tina Müller <tinita@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2018 by Tina Müller

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