File: README

package info (click to toggle)
libyaml-libyaml-perl 0.83%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 656 kB
  • sloc: perl: 1,603; ansic: 1,183; sh: 29; makefile: 4
file content (156 lines) | stat: -rw-r--r-- 4,629 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
NAME

    YAML::XS - Perl YAML Serialization using XS and libyaml

SYNOPSIS

        use YAML::XS;
    
        my $yaml = Dump [ 1..4 ];
        my $array = Load $yaml;

DESCRIPTION

    Kirill Simonov's libyaml is arguably the best YAML implementation. The
    C library is written precisely to the YAML 1.1 specification. It was
    originally bound to Python and was later bound to Ruby.

    This module is a Perl XS binding to libyaml which offers Perl the best
    YAML support to date.

    This module exports the functions Dump, Load, DumpFile and LoadFile.
    These functions are intended to work exactly like YAML.pm's
    corresponding functions. Only Load and Dump are exported by default.

CONFIGURATION

    $YAML::XS::LoadBlessed (since v0.69)

      Default: false.

      The default was changed in version 0.81.

      When set to false, it will not bless data into objects, which can be
      a security problem, when loading YAML from an untrusted source. It
      will silently ignore the tag and just load the data unblessed.

      In PyYAML, this is called SafeLoad.

      If set to true, it will load the following YAML as objects:

          ---
          local: !Foo::Bar [a]
          perl: !!perl/hash:Foo::Bar { a: 1 }
          regex: !!perl/regexp:Foo::Bar pattern

      You can create any kind of object with YAML. The creation itself is
      not the critical part. If the class has a DESTROY method, it will be
      called once the object is deleted. An example with File::Temp
      removing files can be found at
      https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862373

    $YAML::XS::UseCode

    $YAML::XS::DumpCode

    $YAML::XS::LoadCode

      If enabled supports deparsing and evaling of code blocks.

      Note that support for loading code was added in version 0.75,
      although $LoadCode was documented already in earlier versions.

    $YAML::XS::QuoteNumericStrings

      When true (the default) strings that look like numbers but have not
      been numified will be quoted when dumping.

      This ensures leading that things like leading zeros and other
      formatting are preserved.

    $YAML::XS::Boolean (since v0.67)

      Default is undef.

      When set to "JSON::PP" or "boolean", the plain (unquoted) strings
      true and false will be loaded as JSON::PP::Boolean or boolean.pm
      objects. Those objects will be dumped again as plain "true" or
      "false".

      It will try to load JSON::PP or boolean and die if it can't be
      loaded.

      With that it's possible to add new "real" booleans to a data
      structure:

            local $YAML::XS::Boolean = "JSON::PP"; # or "boolean"
            my $data = Load("booltrue: true");
            $data->{boolfalse} = JSON::PP::false;
            my $yaml = Dump($data);
            # boolfalse: false
            # booltrue: true

      It also lets booleans survive when loading YAML via YAML::XS and
      encode it in JSON via one of the various JSON encoders, which mostly
      support JSON::PP booleans.

      Please note that JSON::PP::Boolean and boolean.pm behave a bit
      differently. Ideally you should only use them in boolean context.

      If not set, booleans are loaded as special perl variables PL_sv_yes
      and PL_sv_no, which have the disadvantage that they are readonly, and
      you can't add those to an existing data structure with pure perl.

      If you simply need to load "perl booleans" that are true or false in
      boolean context, you will be fine with the default setting.

    $YAML::XS::Indent (since v0.76)

      Default is 2.

      Sets the number of spaces for indentation for Dump.

USING YAML::XS WITH UNICODE

    Handling unicode properly in Perl can be a pain. YAML::XS only deals
    with streams of utf8 octets. Just remember this:

        $perl = Load($utf8_octets);
        $utf8_octets = Dump($perl);

    There are many, many places where things can go wrong with unicode. If
    you are having problems, use Devel::Peek on all the possible data
    points.

LIBYAML

    You can find out (since v.079) which libyaml version this module was
    built with:

          my $libyaml_version = YAML::XS::LibYAML::libyaml_version();

SEE ALSO

      * YAML.pm

      * YAML::Syck

      * YAML::Tiny

      * YAML::PP

      * YAML::PP::LibYAML

AUTHOR

    Ingy döt Net <ingy@cpan.org>

COPYRIGHT AND LICENSE

    Copyright 2007-2021. Ingy döt Net.

    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

    See http://www.perl.com/perl/misc/Artistic.html