{
    "mode": "perldoc",
    "parameter": "YAML::Any",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/YAML%3A%3AAny/json",
    "generated": "2026-06-14T07:48:35Z",
    "synopsis": "use YAML::Any;\n$YAML::Indent = 3;\nmy $yaml = Dump(@objects);",
    "sections": {
        "NAME": {
            "content": "YAML::Any - Pick a YAML implementation and use it.\n",
            "subsections": []
        },
        "STATUS": {
            "content": "WARNING: This module will soon be deprecated. The plan is that YAML.pm itself will act like an\n*Any* module.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use YAML::Any;\n$YAML::Indent = 3;\nmy $yaml = Dump(@objects);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "There are several YAML implementations that support the Dump/Load API. This module selects the\nbest one available and uses it.\n",
            "subsections": []
        },
        "ORDER": {
            "content": "Currently, YAML::Any will choose the first one of these YAML implementations that is installed\non your system:\n\n*   YAML::XS\n\n*   YAML::Syck\n\n*   YAML::Old\n\n*   YAML\n\n*   YAML::Tiny\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "If you specify an option like:\n\n$YAML::Indent = 4;\n\nAnd YAML::Any is using YAML::XS, it will use the proper variable: $YAML::XS::Indent.\n",
            "subsections": []
        },
        "SUBROUTINES": {
            "content": "Like all the YAML modules that YAML::Any uses, the following subroutines are exported by\ndefault:\n\n*   Dump\n\n*   Load\n\nand the following subroutines are exportable by request:\n\n*   DumpFile\n\n*   LoadFile\n",
            "subsections": []
        },
        "METHODS": {
            "content": "YAML::Any provides the following class methods.\n\n\"YAML::Any->order\"\nThis method returns a list of the current possible implementations that YAML::Any will\nsearch for.\n\n\"YAML::Any->implementation\"\nThis method returns the implementation the YAML::Any will use. This result is obtained by\nfinding the first member of YAML::Any->order that is either already loaded in %INC or that\ncan be loaded using \"require\". If no implementation is found, an error will be thrown.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "",
            "subsections": [
                {
                    "name": "DumpFile and LoadFile",
                    "content": "Here is an example for \"DumpFile\":\n\n#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nuse YAML::Any qw(DumpFile);\n\nmy $ds =\n{\narray => [5,6,100],\nstring => \"Hello\",\n};\n\nDumpFile(\"hello.yml\", $ds);\n\nWhen run, this creates a file called \"hello.yml\" in the current working directory, with the\nfollowing contents.\n\n---\narray:\n- 5\n- 6\n- 100\nstring: Hello\n\nIn turn, the following \"LoadFile\" example, loads the contents from there and accesses them:\n\n#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nuse YAML::Any qw(LoadFile);\n\nmy ($ds) = LoadFile(\"hello.yml\");\n\nprint \"String == '\", $ds->{string}, \"'\\n\";\n\nAssuming \"hello.yml\" exists, and is as created by the \"DumpFile\" example, it prints:\n\n$ perl load.pl\nString == 'Hello'\n$\n"
                }
            ]
        },
        "AUTHOR": {
            "content": "Ingy döt Net <ingy@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2001-2014. Ingy döt Net\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nSee <http://www.perl.com/perl/misc/Artistic.html>\n",
            "subsections": []
        }
    },
    "summary": "YAML::Any - Pick a YAML implementation and use it.",
    "flags": [],
    "examples": [
        "Here is an example for \"DumpFile\":",
        "#!/usr/bin/perl",
        "use strict;",
        "use warnings;",
        "use YAML::Any qw(DumpFile);",
        "my $ds =",
        "array => [5,6,100],",
        "string => \"Hello\",",
        "};",
        "DumpFile(\"hello.yml\", $ds);",
        "When run, this creates a file called \"hello.yml\" in the current working directory, with the",
        "following contents.",
        "---",
        "array:",
        "- 5",
        "- 6",
        "- 100",
        "string: Hello",
        "In turn, the following \"LoadFile\" example, loads the contents from there and accesses them:",
        "#!/usr/bin/perl",
        "use strict;",
        "use warnings;",
        "use YAML::Any qw(LoadFile);",
        "my ($ds) = LoadFile(\"hello.yml\");",
        "print \"String == '\", $ds->{string}, \"'\\n\";",
        "Assuming \"hello.yml\" exists, and is as created by the \"DumpFile\" example, it prints:",
        "$ perl load.pl",
        "String == 'Hello'"
    ],
    "see_also": []
}