1NAME 2 YAML::Syck - Fast, lightweight YAML loader and dumper 3 4VERSION 5 This document describes version 1.07 of YAML::Syck, released April 25, 6 2009. 7 8SYNOPSIS 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 26DESCRIPTION 27 This module provides a Perl interface to the libsyck data serialization 28 library. It exports the "Dump" and "Load" functions for converting Perl 29 data structures to YAML strings, and the other way around. 30 31 NOTE: If you are working with other language's YAML/Syck bindings (such 32 as Ruby), please set $YAML::Syck::ImplicitTyping to 1 before calling the 33 "Load"/"Dump" functions. The default setting is for preserving 34 backward-compatibility with "YAML.pm". 35 36FLAGS 37 $YAML::Syck::Headless 38 Defaults to false. Setting this to a true value will make "Dump" omit 39 the leading "---\n" marker. 40 41 $YAML::Syck::SortKeys 42 Defaults to false. Setting this to a true value will make "Dump" sort 43 hash keys. 44 45 $YAML::Syck::SingleQuote 46 Defaults to false. Setting this to a true value will make "Dump" always 47 emit single quotes instead of bare strings. 48 49 $YAML::Syck::ImplicitTyping 50 Defaults to false. Setting this to a true value will make "Load" 51 recognize various implicit types in YAML, such as unquoted "true", 52 "false", as well as integers and floating-point numbers. Otherwise, only 53 "~" is recognized to be "undef". 54 55 $YAML::Syck::ImplicitUnicode 56 Defaults to false. For Perl 5.8.0 or later, setting this to a true value 57 will make "Load" set Unicode flag on for every string that contains 58 valid UTF8 sequences, and make "Dump" return a unicode string. 59 60 Regardless of this flag, Unicode strings are dumped verbatim without 61 escaping; byte strings with high-bit set will be dumped with backslash 62 escaping. 63 64 However, because YAML does not distinguish between these two kinds of 65 strings, so this flag will affect loading of both variants of strings. 66 67 $YAML::Syck::ImplicitBinary 68 Defaults to false. For Perl 5.8.0 or later, setting this to a true value 69 will make "Dump" generate Base64-encoded "!!binary" data for all 70 non-Unicode scalars containing high-bit bytes. 71 72 $YAML::Syck::UseCode / $YAML::Syck::LoadCode / $YAML::Syck::DumpCode 73 These flags control whether or not to try and eval/deparse perl source 74 code; each of them defaults to false. 75 76 Setting $YAML::Syck::UseCode to a true value is equivalent to setting 77 both $YAML::Syck::LoadCode and $YAML::Syck::DumpCode to true. 78 79BUGS 80 Dumping Glob/IO values does not work yet. 81 82CAVEATS 83 This module implements the YAML 1.0 spec. To deal with data in YAML 1.1, 84 please use the "YAML::XS" module instead. 85 86 The current implementation bundles libsyck source code; if your system 87 has a site-wide shared libsyck, it will *not* be used. 88 89 Tag names such as "!!perl/hash:Foo" is blessed into the package "Foo", 90 but the "!hs/foo" and "!!hs/Foo" tags are blessed into "hs::Foo". Note 91 that this holds true even if the tag contains non-word characters; for 92 example, "!haskell.org/Foo" is blessed into "haskell.org::Foo". Please 93 use Class::Rebless to cast it into other user-defined packages. 94 95SEE ALSO 96 YAML, JSON::Syck 97 98 <http://www.yaml.org/> 99 100AUTHORS 101 Audrey Tang <cpan@audreyt.org> 102 103COPYRIGHT 104 Copyright 2005-2009 by Audrey Tang <cpan@audreyt.org>. 105 106 This software is released under the MIT license cited below. 107 108 The libsyck code bundled with this library is released by "why the lucky 109 stiff", under a BSD-style license. See the COPYING file for details. 110 111 The "MIT" License 112 Permission is hereby granted, free of charge, to any person obtaining a 113 copy of this software and associated documentation files (the 114 "Software"), to deal in the Software without restriction, including 115 without limitation the rights to use, copy, modify, merge, publish, 116 distribute, sublicense, and/or sell copies of the Software, and to 117 permit persons to whom the Software is furnished to do so, subject to 118 the following 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 125 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 126 IN 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 129 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 130 131