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 0.82 of YAML::Syck, released January
10 26, 2007.
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 undef.
17 $YAML::Syck::ImplicitTyping = 1;
18
19 $data = Load($yaml);
20 $data = LoadFile($file);
21 $yaml = Dump($data);
22 DumpFile($file, $data);
23
24 # A string with multiple YAML streams in it
25 $yaml = Dump(@data);
26 @data = Load($yaml);
27
29 This module provides a Perl interface to the libsyck data serialization
30 library. It exports the "Dump" and "Load" functions for converting
31 Perl data structures to YAML strings, and the other way around.
32
33 NOTE: If you are working with other language's YAML/Syck bindings (such
34 as Ruby), please set $YAML::Syck::ImplicitTyping to 1 before calling
35 the "Load"/"Dump" functions. The default setting is for preserving
36 backward-compatibility with "YAML.pm".
37
39 $YAML::Syck::Headless
40
41 Defaults to false. Setting this to a true value will make "Dump" omit
42 the leading "---\n" marker.
43
44 $YAML::Syck::SortKeys
45
46 Defaults to false. Setting this to a true value will make "Dump" sort
47 hash keys.
48
49 $YAML::Syck::ImplicitTyping
50
51 Defaults to false. Setting this to a true value will make "Load" rec‐
52 ognize various implicit types in YAML, such as unquoted "true",
53 "false", as well as integers and floating-point numbers. Otherwise,
54 only "~" is recognized to be "undef".
55
56 $YAML::Syck::ImplicitUnicode
57
58 Defaults to false. For Perl 5.8.0 or later, setting this to a true
59 value will make "Load" set Unicode flag on for every string that con‐
60 tains valid UTF8 sequences, and make "Dump" return a unicode string.
61
62 Regardless of this flag, Unicode strings are dumped verbatim without
63 escaping; byte strings with high-bit set will be dumped with backslash
64 escaping.
65
66 However, because YAML does not distinguish between these two kinds of
67 strings, so this flag will affect loading of both variants of strings.
68
69 $YAML::Syck::ImplicitBinary
70
71 Defaults to false. For Perl 5.8.0 or later, setting this to a true
72 value will make "Dump" generate Base64-encoded "!!binary" data for all
73 non-Unicode scalars containing high-bit bytes.
74
75 $YAML::Syck::UseCode
76
77 $YAML::Syck::LoadCode
78
79 $YAML::Syck::DumpCode
80
81 These control whether or not to try and eval/deparse perl source code.
82
84 The current implementation bundles libsyck source code; if your system
85 has a side-wide shared libsyck, it will not be used.
86
87 Tag names such as "!!perl/hash:Foo" is blessed into the package "Foo",
88 but the "!hs/foo" and "!!hs/Foo" tags are blessed into "hs::Foo". Note
89 that this holds true even if the tag contains non-word characters; for
90 example, "!haskell.org/Foo" is blessed into "haskell.org::Foo". Please
91 use Class::Rebless to cast it into other user-defined packages.
92
94 YAML, JSON::Syck
95
96 <http://www.yaml.org/>
97
99 Audrey Tang <cpan@audreyt.org>
100
102 Copyright 2005, 2006, 2007 by Audrey Tang <cpan@audreyt.org>.
103
104 This software is released under the MIT license cited below.
105
106 The libsyck code bundled with this library is released by "why the
107 lucky stiff", under a BSD-style license. See the COPYING file for
108 details.
109
110 The "MIT" License
111
112 Permission is hereby granted, free of charge, to any person obtaining a
113 copy of this software and associated documentation files (the "Soft‐
114 ware"), to deal in the Software without restriction, including without
115 limitation the rights to use, copy, modify, merge, publish, distribute,
116 sublicense, and/or sell copies of the Software, and to permit persons
117 to whom the Software is furnished to do so, subject to the following
118 conditions:
119
120 The above copyright notice and this permission notice shall be included
121 in all copies or substantial portions of the Software.
122
123 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
124 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER‐
125 CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
126 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
127 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
128 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT‐
129 WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
130
131
132
133perl v5.8.8 2007-01-25 YAML::Syck(3)