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 Included libyaml: Copyright (c) 2017-2020 Ingy döt Net Copyright (c)
64 2006-2016 Kirill Simonov
65
66 Perl/XS binding: Copyright (c) 2022 by Tina Müller.
67
68 This is free software, licensed under:
69
70 The MIT (X11) License
71
72 The MIT License
73
74 Permission is hereby granted, free of charge, to any person obtaining a
75 copy of this software and associated documentation files (the
76 "Software"), to deal in the Software without restriction, including
77 without limitation the rights to use, copy, modify, merge, publish,
78 distribute, sublicense, and/or sell copies of the Software, and to
79 permit persons to whom the Software is furnished to do so, subject to
80 the following conditions:
81
82 The above copyright notice and this permission notice shall be included
83 in all copies or substantial portions of the Software.
84
85 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
86 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
87 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
88 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
89 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
90 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
91 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
92
93
94
95perl v5.36.0 2022-07-22 YAML::LibYAML::API(3)