1YAML::Syck(3) User Contributed Perl Documentation YAML::Syck(3)
2
3
4
6 YAML::Syck - Fast, lightweight YAML loader and dumper
7
9 This document describes version 1.07 of YAML::Syck, released April 25,
10 2009.
11
13 use YAML::Syck;
14
15 # Set this for interoperability with other YAML/Syck bindings:
16 # e.g. Load('Yes') becomes 1 and Load('No') becomes ''.
17 $YAML::Syck::ImplicitTyping = 1;
18
19 $data = Load($yaml);
20 $yaml = Dump($data);
21
22 # $file can be an IO object, or a filename
23 $data = LoadFile($file);
24 DumpFile($file, $data);
25
26 # A string with multiple YAML streams in it
27 $yaml = Dump(@data);
28 @data = Load($yaml);
29
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
41 $YAML::Syck::Headless
42 Defaults to false. Setting this to a true value will make "Dump" omit
43 the leading "---\n" marker.
44
45 $YAML::Syck::SortKeys
46 Defaults to false. Setting this to a true value will make "Dump" sort
47 hash keys.
48
49 $YAML::Syck::SingleQuote
50 Defaults to false. Setting this to a true value will make "Dump"
51 always emit single quotes instead of bare strings.
52
53 $YAML::Syck::ImplicitTyping
54 Defaults to false. Setting this to a true value will make "Load"
55 recognize various implicit types in YAML, such as unquoted "true",
56 "false", as well as integers and floating-point numbers. Otherwise,
57 only "~" is recognized to be "undef".
58
59 $YAML::Syck::ImplicitUnicode
60 Defaults to false. For Perl 5.8.0 or later, setting this to a true
61 value will make "Load" set Unicode flag on for every string that
62 contains valid UTF8 sequences, and make "Dump" return a unicode string.
63
64 Regardless of this flag, Unicode strings are dumped verbatim without
65 escaping; byte strings with high-bit set will be dumped with backslash
66 escaping.
67
68 However, because YAML does not distinguish between these two kinds of
69 strings, so this flag will affect loading of both variants of strings.
70
71 $YAML::Syck::ImplicitBinary
72 Defaults to false. For Perl 5.8.0 or later, setting this to a true
73 value will make "Dump" generate Base64-encoded "!!binary" data for all
74 non-Unicode scalars containing high-bit bytes.
75
76 $YAML::Syck::UseCode / $YAML::Syck::LoadCode / $YAML::Syck::DumpCode
77 These flags control whether or not to try and eval/deparse perl source
78 code; each of them defaults to false.
79
80 Setting $YAML::Syck::UseCode to a true value is equivalent to setting
81 both $YAML::Syck::LoadCode and $YAML::Syck::DumpCode to true.
82
84 Dumping Glob/IO values does not work yet.
85
87 This module implements the YAML 1.0 spec. To deal with data in YAML
88 1.1, please use the "YAML::XS" module instead.
89
90 The current implementation bundles libsyck source code; if your system
91 has a site-wide shared libsyck, it will not be used.
92
93 Tag names such as "!!perl/hash:Foo" is blessed into the package "Foo",
94 but the "!hs/foo" and "!!hs/Foo" tags are blessed into "hs::Foo". Note
95 that this holds true even if the tag contains non-word characters; for
96 example, "!haskell.org/Foo" is blessed into "haskell.org::Foo". Please
97 use Class::Rebless to cast it into other user-defined packages.
98
100 YAML, JSON::Syck
101
102 <http://www.yaml.org/>
103
105 Audrey Tang <cpan@audreyt.org>
106
108 Copyright 2005-2009 by Audrey Tang <cpan@audreyt.org>.
109
110 This software is released under the MIT license cited below.
111
112 The libsyck code bundled with this library is released by "why the
113 lucky stiff", under a BSD-style license. See the COPYING file for
114 details.
115
116 The "MIT" License
117 Permission is hereby granted, free of charge, to any person obtaining a
118 copy of this software and associated documentation files (the
119 "Software"), to deal in the Software without restriction, including
120 without limitation the rights to use, copy, modify, merge, publish,
121 distribute, sublicense, and/or sell copies of the Software, and to
122 permit persons to whom the Software is furnished to do so, subject to
123 the following conditions:
124
125 The above copyright notice and this permission notice shall be included
126 in all copies or substantial portions of the Software.
127
128 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
129 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
130 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
131 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
132 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
133 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
134 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
135
136
137
138perl v5.12.0 2009-04-25 YAML::Syck(3)