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

NAME

YAML::LibYAML::API - Wrapper around the C libyaml library

SYNOPSIS

    use YAML::LibYAML::API::XS;

    my $version = YAML::LibYAML::API::XS::libyaml_version();

    my $yaml = <<'EOM';
    # An example of various kinds of events
    ---
    foo: &ALIAS bar
    'alias': *ALIAS
    tag: !!int 23
    list:
    - "doublequoted"
    - >
      folded
    - |-
      literal
    EOM

    # parse
    my $events = [];
    YAML::LibYAML::API::XS::parse_string_events($yaml, $events);
    # or:
    YAML::LibYAML::API::XS::parse_file_events($filename, $events);
    YAML::LibYAML::API::XS::parse_filehandle_events($fh, $events);

    # emit
    my $yaml = YAML::LibYAML::API::XS::emit_string_events($events, {
        indent => 2,
        width => 80,
        unicode => 1, # emit unicode
    });
    # or:
    my $options = {
        indent => 2,
        width => 80,
    };
    YAML::LibYAML::API::XS::emit_file_events($filename, $events, $options);
    YAML::LibYAML::API::XS::emit_filehandle_events($fh, $events, $options);

DESCRIPTION

This module provides a thin wrapper around the C libyaml API.

Currently it provides functions for parsing and emitting events.

libyaml also provides a loader/dumper API to load/dump YAML into a list of nodes. There's no wrapper for these functions yet.

This is just one of the first releases. The function names will eventually be changed.

The sources of libyaml-dev are included in this distribution. You can build this module with the system libyaml instead, if you remove the libyaml sources and call Makefile.PL with WITH_SYSTEM_LIBYAML=1.

SEE ALSO

libyaml
YAML::XS

AUTHOR

Tina Müller <tinita@cpan.org>

COPYRIGHT AND LICENSE

Included libyaml: Copyright (c) 2017-2020 Ingy döt Net Copyright (c) 2006-2016 Kirill Simonov

Perl/XS binding: Copyright (c) 2022 by Tina Müller.

This is free software, licensed under:

  The MIT (X11) License

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.