1YAML::LibYAML::API(3) User Contributed Perl DocumentationYAML::LibYAML::API(3)
2
3
4
6 YAML::LibYAML::API - Wrapper around the C libyaml library
7
9 use YAML::LibYAML::API::XS;
10
11 my $version = YAML::LibYAML::API::XS::libyaml_version();
12
13 my $yaml = <<'EOM';
14 # An example of various kinds of events
15 ---
16 foo: &ALIAS bar
17 'alias': *ALIAS
18 tag: !!int 23
19 list:
20 - "doublequoted"
21 - >
22 folded
23 - |-
24 literal
25 EOM
26
27 # parse
28 my $events = [];
29 YAML::LibYAML::API::XS::parse_string_events($yaml, $events);
30 # or:
31 YAML::LibYAML::API::XS::parse_file_events($filename, $events);
32 YAML::LibYAML::API::XS::parse_filehandle_events($fh, $events);
33
34 # emit
35 my $yaml = YAML::LibYAML::API::XS::emit_string_events($events);
36 # or:
37 YAML::LibYAML::API::XS::emit_file_events($filename, $events);
38 YAML::LibYAML::API::XS::emit_filehandle_events($fh, $events);
39
41 This module provides a thin wrapper around the C libyaml API.
42
43 Currently it provides functions for parsing and emitting events.
44
45 libyaml also provides a loader/dumper API to load/dump YAML into a list
46 of nodes. There's no wrapper for these functions yet.
47
48 This is just one of the first releases. The function names will
49 eventually be changed.
50
51 The sources of "libyaml-dev" are included in this distribution. You can
52 build this module with the system libyaml instead, if you remove the
53 libyaml sources and call "Makefile.PL" with "WITH_SYSTEM_LIBYAML=1".
54
56 libyaml <https://github.com/yaml/libyaml>
57 YAML::XS
58
60 Tina Müller <tinita@cpan.org>
61
63 Copyright 2018 by Tina Müller
64
65 This library is free software and may be distributed under the same
66 terms as perl itself.
67
68
69
70perl v5.34.0 2022-01-21 YAML::LibYAML::API(3)