1YAML::Any(3)          User Contributed Perl Documentation         YAML::Any(3)
2
3
4

NAME

6       YAML::Any - Pick a YAML implementation and use it.
7

STATUS

9       WARNING: This module will soon be deprecated. The plan is that YAML.pm
10       itself will act like an Any module.
11

SYNOPSIS

13           use YAML::Any;
14           $YAML::Indent = 3;
15           my $yaml = Dump(@objects);
16

DESCRIPTION

18       There are several YAML implementations that support the Dump/Load API.
19       This module selects the best one available and uses it.
20

ORDER

22       Currently, YAML::Any will choose the first one of these YAML
23       implementations that is installed on your system:
24
25       ·   YAML::XS
26
27       ·   YAML::Syck
28
29       ·   YAML::Old
30
31       ·   YAML
32
33       ·   YAML::Tiny
34

OPTIONS

36       If you specify an option like:
37
38           $YAML::Indent = 4;
39
40       And YAML::Any is using YAML::XS, it will use the proper variable:
41       $YAML::XS::Indent.
42

SUBROUTINES

44       Like all the YAML modules that YAML::Any uses, the following
45       subroutines are exported by default:
46
47       ·   Dump
48
49       ·   Load
50
51       and the following subroutines are exportable by request:
52
53       ·   DumpFile
54
55       ·   LoadFile
56

METHODS

58       YAML::Any provides the following class methods.
59
60       "YAML::Any->order"
61           This method returns a list of the current possible implementations
62           that YAML::Any will search for.
63
64       "YAML::Any->implementation"
65           This method returns the implementation the YAML::Any will use. This
66           result is obtained by finding the first member of YAML::Any->order
67           that is either already loaded in %INC or that can be loaded using
68           "require". If no implementation is found, an error will be thrown.
69

EXAMPLES

71   DumpFile and LoadFile
72       Here is an example for "DumpFile":
73
74           #!/usr/bin/perl
75
76           use strict;
77           use warnings;
78
79           use YAML::Any qw(DumpFile);
80
81           my $ds =
82           {
83               array => [5,6,100],
84               string => "Hello",
85           };
86
87           DumpFile("hello.yml", $ds);
88
89       When run, this creates a file called "hello.yml" in the current working
90       directory, with the following contents.
91
92           ---
93           array:
94           - 5
95           - 6
96           - 100
97           string: Hello
98
99       In turn, the following "LoadFile" example, loads the contents from
100       there and accesses them:
101
102           #!/usr/bin/perl
103
104           use strict;
105           use warnings;
106
107           use YAML::Any qw(LoadFile);
108
109           my ($ds) = LoadFile("hello.yml");
110
111           print "String == '", $ds->{string}, "'\n";
112
113       Assuming "hello.yml" exists, and is as created by the "DumpFile"
114       example, it prints:
115
116           $ perl load.pl
117           String == 'Hello'
118           $
119

AUTHOR

121       Ingy döt Net <ingy@cpan.org>
122
124       Copyright 2001-2014. Ingy döt Net
125
126       This program is free software; you can redistribute it and/or modify it
127       under the same terms as Perl itself.
128
129       See <http://www.perl.com/perl/misc/Artistic.html>
130
131
132
133perl v5.30.1                      2020-03-13                      YAML::Any(3)
Impressum