Vulnerabilities | |||||
---|---|---|---|---|---|
Version | Suggest | Low | Medium | High | Critical |
0.90 | 0 | 0 | 0 | 0 | 0 |
0.89 | 0 | 0 | 0 | 0 | 0 |
0.84 | 0 | 0 | 0 | 0 | 0 |
0.83 | 0 | 0 | 0 | 0 | 0 |
0.82 | 0 | 0 | 0 | 0 | 0 |
0.81 | 0 | 0 | 0 | 0 | 0 |
0.80 | 0 | 0 | 0 | 0 | 0 |
0.79 | 0 | 0 | 0 | 0 | 0 |
0.78 | 0 | 0 | 0 | 0 | 0 |
0.77 | 0 | 0 | 0 | 0 | 0 |
0.76 | 0 | 0 | 0 | 0 | 0 |
0.75 | 0 | 0 | 0 | 0 | 0 |
0.72 | 0 | 0 | 0 | 0 | 0 |
0.70 | 0 | 0 | 0 | 0 | 0 |
0.69 | 0 | 0 | 0 | 0 | 0 |
0.68 | 0 | 0 | 1 | 0 | 0 |
0.67 | 0 | 0 | 1 | 0 | 0 |
0.66 | 0 | 0 | 1 | 0 | 0 |
0.65 | 0 | 0 | 1 | 0 | 0 |
0.64 | 0 | 0 | 1 | 0 | 0 |
0.63 | 0 | 0 | 1 | 0 | 0 |
0.62 | 0 | 0 | 1 | 0 | 0 |
0.89_001 | 0 | 0 | 0 | 0 | 0 |
0.88_001 | 0 | 0 | 0 | 0 | 0 |
0.82_001 | 0 | 0 | 0 | 0 | 0 |
0.79_001 | 0 | 0 | 0 | 0 | 0 |
0.78_002 | 0 | 0 | 0 | 0 | 0 |
0.78_001 | 0 | 0 | 0 | 0 | 0 |
0.77_001 | 0 | 0 | 0 | 0 | 0 |
0.76_001 | 0 | 0 | 0 | 0 | 0 |
0.75_001 | 0 | 0 | 0 | 0 | 0 |
0.74_001 | 0 | 0 | 0 | 0 | 0 |
0.70_001 | 0 | 0 | 0 | 0 | 0 |
0.69_001 | 0 | 0 | 1 | 0 | 0 |
0.68_002 | 0 | 0 | 1 | 0 | 0 |
0.68_001 | 0 | 0 | 1 | 0 | 0 |
0.67_001 | 0 | 0 | 1 | 0 | 0 |
0.66_002 | 0 | 0 | 1 | 0 | 0 |
0.66_001 | 0 | 0 | 1 | 0 | 0 |
0.65_001 | 0 | 0 | 1 | 0 | 0 |
0.63_002 | 0 | 0 | 1 | 0 | 0 |
0.90 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
Artistic-1.0 - Artistic License 1.0Perl YAML Serialization using XS and libyaml
use YAML::XS;
my $yaml = Dump [ 1..4 ];
my $array = Load $yaml;
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.
$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::ForbidDuplicateKeys
(since 0.84)
Default: false
When set to true, Load
will die when encountering a duplicate key in a
hash, e.g.
key: value
key: another value
This can be useful for bigger YAML documents where it is not that obvious, and it is recommended to set it to true. That's also what a YAML loader should do by default according to the YAML specification.
$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: undef
When used with perl 5.36 or later, builtin booleans will work out of the
box. They will be created by Load
and recognized by Dump
automatically
(since YAML::XS 0.89).
say Dump({ truth => builtin::true });
# truth: true
For older perl versions you can use the following configuration to serialize data as YAML booleans:
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
.
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.
You can find out (since v.079) which libyaml version this module was built with:
my $libyaml_version = YAML::XS::LibYAML::libyaml_version();
Ingy döt Net ingy@ingy.net
Copyright 2007-2024 - Ingy döt Net
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.