1YAML::Syck(3)         User Contributed Perl Documentation        YAML::Syck(3)
2
3
4

NAME

6       YAML::Syck - Fast, lightweight YAML loader and dumper
7

SYNOPSIS

9           use YAML::Syck;
10
11           # Set this for interoperability with other YAML/Syck bindings:
12           # e.g. Load('Yes') becomes 1 and Load('No') becomes ''.
13           $YAML::Syck::ImplicitTyping = 1;
14
15           $data = Load($yaml);
16           $yaml = Dump($data);
17
18           # $file can be an IO object, or a filename
19           $data = LoadFile($file);
20           DumpFile($file, $data);
21
22           # A string with multiple YAML streams in it
23           $yaml = Dump(@data);
24           @data = Load($yaml);
25
26           # Dumping into a pre-existing output buffer
27           my $yaml;
28           DumpInto(\$yaml, @data);
29

DESCRIPTION

31       This module provides a Perl interface to the libsyck data serialization
32       library.  It exports the "Dump" and "Load" functions for converting
33       Perl data structures to YAML strings, and the other way around.
34
35       NOTE: If you are working with other language's YAML/Syck bindings (such
36       as Ruby), please set $YAML::Syck::ImplicitTyping to 1 before calling
37       the "Load"/"Dump" functions.  The default setting is for preserving
38       backward-compatibility with "YAML.pm".
39

Differences Between YAML::Syck and YAML

41   Error handling
42       Some calls are designed to die rather than returning YAML. You should
43       wrap your calls in eval to assure you do not get unexpected results.
44

FLAGS

46   $YAML::Syck::Headless
47       Defaults to false.  Setting this to a true value will make "Dump" omit
48       the leading "---\n" marker.
49
50   $YAML::Syck::SortKeys
51       Defaults to false.  Setting this to a true value will make "Dump" sort
52       hash keys.
53
54   $YAML::Syck::SingleQuote
55       Defaults to false.  Setting this to a true value will make "Dump"
56       always emit single quotes instead of bare strings.
57
58   $YAML::Syck::ImplicitTyping
59       Defaults to false.  Setting this to a true value will make "Load"
60       recognize various implicit types in YAML, such as unquoted "true",
61       "false", as well as integers and floating-point numbers.  Otherwise,
62       only "~" is recognized to be "undef".
63
64   $YAML::Syck::ImplicitUnicode
65       Defaults to false.  For Perl 5.8.0 or later, setting this to a true
66       value will make "Load" set Unicode flag on for every string that
67       contains valid UTF8 sequences, and make "Dump" return a unicode string.
68
69       Regardless of this flag, Unicode strings are dumped verbatim without
70       escaping; byte strings with high-bit set will be dumped with backslash
71       escaping.
72
73       However, because YAML does not distinguish between these two kinds of
74       strings, so this flag will affect loading of both variants of strings.
75
76       If you want to use LoadFile or DumpFile with unicode, you are required
77       to open your own file in order to assure it's UTF8 encoded:
78
79         open(my $fh, ">:encoding(UTF-8)", "out.yml");
80         DumpFile($fh, $hashref);
81
82   $YAML::Syck::ImplicitBinary
83       Defaults to false.  For Perl 5.8.0 or later, setting this to a true
84       value will make "Dump" generate Base64-encoded "!!binary" data for all
85       non-Unicode scalars containing high-bit bytes.
86
87   $YAML::Syck::UseCode / $YAML::Syck::LoadCode / $YAML::Syck::DumpCode
88       These flags control whether or not to try and eval/deparse perl source
89       code; each of them defaults to false.
90
91       Setting $YAML::Syck::UseCode to a true value is equivalent to setting
92       both $YAML::Syck::LoadCode and $YAML::Syck::DumpCode to true.
93
94   $YAML::Syck::LoadBlessed
95       Defaults to true. Setting to false will block YAML::Syck from doing ANY
96       blessing. This is an interface change since 1.21. The variable name was
97       misleading, implying that no blessing would happen when in fact it did.
98
99       Prior to 1.22, setting this to a false value only prevented "Load" from
100       blessing tag names that did not begin with "!!perl" or "!perl";.
101

BUGS

103       Dumping Glob/IO values do not work yet.
104
105       Dumping of Tied variables is unsupported.
106
107       Dumping into tied (or other magic variables) with "DumpInto" might not
108       work properly in all cases.
109

CAVEATS

111       This module implements the YAML 1.0 spec.  To deal with data in YAML
112       1.1, please use the "YAML::XS" module instead.
113
114       The current implementation bundles libsyck source code; if your system
115       has a site-wide shared libsyck, it will not be used.
116
117       Tag names such as "!!perl/hash:Foo" is blessed into the package "Foo",
118       but the "!hs/foo" and "!!hs/Foo" tags are blessed into "hs::Foo".  Note
119       that this holds true even if the tag contains non-word characters; for
120       example, "!haskell.org/Foo" is blessed into "haskell.org::Foo".  Please
121       use Class::Rebless to cast it into other user-defined packages. You can
122       also set the LoadBlessed flag false to disable all blessing.
123
124       This module has a lot of known issues
125       <https://rt.cpan.org/Public/Dist/Display.html?Name=YAML-Syck> and has
126       only been semi-actively maintained since 2007. If you encounter an
127       issue with it probably won't be fixed unless you offer up a patch
128       <http://github.com/toddr/YAML-Syck> in Git that's ready for release.
129
130       There are still good reasons to use this module, such as better
131       interoperability with other syck wrappers (like Ruby's), or some edge
132       case of YAML's syntax that it handles better. It'll probably work
133       perfectly for you, but if it doesn't you may want to look at YAML::XS,
134       or perhaps at looking another serialization format like JSON.
135

SEE ALSO

137       YAML, JSON::Syck
138
139       <http://www.yaml.org/>
140

AUTHORS

142       Audrey Tang <cpan@audreyt.org>
143
145       Copyright 2005-2009 by Audrey Tang <cpan@audreyt.org>.
146
147       This software is released under the MIT license cited below.
148
149       The libsyck code bundled with this library is released by "why the
150       lucky stiff", under a BSD-style license.  See the COPYING file for
151       details.
152
153   The "MIT" License
154       Permission is hereby granted, free of charge, to any person obtaining a
155       copy of this software and associated documentation files (the
156       "Software"), to deal in the Software without restriction, including
157       without limitation the rights to use, copy, modify, merge, publish,
158       distribute, sublicense, and/or sell copies of the Software, and to
159       permit persons to whom the Software is furnished to do so, subject to
160       the following conditions:
161
162       The above copyright notice and this permission notice shall be included
163       in all copies or substantial portions of the Software.
164
165       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
166       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
167       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
168       IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
169       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
170       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
171       SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
172
173
174
175perl v5.16.3                      2013-05-21                     YAML::Syck(3)
Impressum