NAME

LibYAML::FFI - FFI binding for C libyaml

SYNOPSIS

    use LibYAML::FFI;
    my $ok = $parser->yaml_parser_initialize;
    my $input = <<'EOM';
    foo: [
        &ALIAS bar, *ALIAS
      ]
    EOM
    $parser->yaml_parser_set_input_string($input, length($input));
    my $events;
    while (1) {
        my $event = LibYAML::FFI::Event->new;
        my $ok = $parser->yaml_parser_parse($event);
        my $str = $event->as_string;
        print "Event: $str";
        last unless $ok;
        last if $event->type == LibYAML::FFI::event_type::YAML_STREAM_END_EVENT;
    }

DESCRIPTION

This is a Proof of Concept for now. It uses FFI::Platypus to provide a wrapper around the C library libyaml. For now it can only parse, not emit. Libyaml sources are included for now, I would like to use Alien::LibYAML in the future.

For loading a data structure, see LibYAML::FFI::YPP in this distribution.

SEE ALSO

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

COPYRIGHT AND LICENSE

Copyright 2023 by Tina Müller

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