YAML::Syck (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
YAML::Syck - Fast, lightweight YAML loader and dumperSYNOPSIS
use YAML::Syck; # Set this for interoperability with other YAML/Syck bindings: # e.g. Load('Yes') becomes 1 and Load('No') becomes ''. $YAML::Syck::ImplicitTyping = 1; $data = Load($yaml); $yaml = Dump($data); # $file can be an IO object, or a filename $data = LoadFile($file); DumpFile($file, $data); # A string with multiple YAML streams in it $yaml = Dump(@data); @data = Load($yaml); # Dumping into a pre-existing output buffer my $yaml; DumpInto(\$yaml, @data);
DESCRIPTION
This module provides a Perl interface to the libsyck data serialization library. It exports the "Dump" and "Load" functions for converting Perl data structures to
Differences Between YAML::Syck and YAML
Error handling
Some calls are designed to die rather than returningFLAGS
$YAML::Syck::Headless
Defaults to false. Setting this to a true value will make "Dump" omit the leading "---\n" marker.$YAML::Syck::SortKeys
Defaults to false. Setting this to a true value will make "Dump" sort hash keys.$YAML::Syck::SingleQuote
Defaults to false. Setting this to a true value will make "Dump" always emit single quotes instead of bare strings.$YAML::Syck::ImplicitTyping
Defaults to false. Setting this to a true value will make "Load" recognize various implicit types in$YAML::Syck::ImplicitUnicode
Defaults to false. For Perl 5.8.0 or later, setting this to a true value will make "Load" set Unicode flag on for every string that contains validRegardless of this flag, Unicode strings are dumped verbatim without escaping; byte strings with high-bit set will be dumped with backslash escaping.
However, because
If you want to use LoadFile or DumpFile with unicode, you are required to open your own file in order to assure it's
open(my $fh, ">:encoding(UTF-8)", "out.yml"); DumpFile($fh, $hashref);
$YAML::Syck::ImplicitBinary
Defaults to false. For Perl 5.8.0 or later, setting this to a true value will make "Dump" generate Base64-encoded "!!binary" data for all non-Unicode scalars containing high-bit bytes.$YAML::Syck::UseCode / $YAML::Syck::LoadCode / $YAML::Syck::DumpCode
These flags control whether or not to try and eval/deparse perl source code; each of them defaults to false.Setting $YAML::Syck::UseCode to a true value is equivalent to setting both $YAML::Syck::LoadCode and $YAML::Syck::DumpCode to true.
$YAML::Syck::LoadBlessed
Defaults to true. Setting to false will block YAML::Syck from doingPrior to 1.22, setting this to a false value only prevented "Load" from blessing tag names that did not begin with "!!perl" or "!perl";.
BUGS
Dumping Glob/IO values do not work yet.Dumping of Tied variables is unsupported.
Dumping into tied (or other magic variables) with "DumpInto" might not work properly in all cases.
CAVEATS
This module implements theThe current implementation bundles libsyck source code; if your system has a site-wide shared libsyck, it will not be used.
Tag names such as "!!perl/hash:Foo" is blessed into the package "Foo", but the "!hs/foo" and "!!hs/Foo" tags are blessed into "hs::Foo". Note that this holds true even if the tag contains non-word characters; for example, "!haskell.org/Foo" is blessed into "haskell.org::Foo". Please use Class::Rebless to cast it into other user-defined packages. You can also set the LoadBlessed flag false to disable all blessing.
This module has a lot of known issues <rt.cpan.org/Public/Dist/Display.html?Name=YAML-Syck> and has only been semi-actively maintained since 2007. If you encounter an issue with it probably won't be fixed unless you offer up a patch <github.com/toddr/YAML-Syck> in Git that's ready for release.
There are still good reasons to use this module, such as better interoperability with other syck wrappers (like Ruby's), or some edge case of
SEE ALSO
AUTHORS
Audrey Tang <cpan@audreyt.org>COPYRIGHT
Copyright 2005-2009 by Audrey Tang <cpan@audreyt.org>.This software is released under the
The libsyck code bundled with this library is released by ``why the lucky stiff'', under a BSD-style license. See the
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ``Software''), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.