{"id":7058,"date":"2022-12-20T19:34:48","date_gmt":"2022-12-20T22:34:48","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/yamlany-man3\/"},"modified":"2022-12-20T19:34:48","modified_gmt":"2022-12-20T22:34:48","slug":"yamlany-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/yamlany-man3\/","title":{"rendered":"YAML::Any (man3)"},"content":{"rendered":"<h1 align=\"center\">YAML::Any<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#STATUS\">STATUS<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#ORDER\">ORDER<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#SUBROUTINES\">SUBROUTINES<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">YAML::Any \u2212 Pick a YAML implementation and use it.<\/p>\n<h2>STATUS <a name=\"STATUS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><small>WARNING:<\/small> This module will soon be deprecated. The plan is that <small>YAML<\/small> .pm itself will act like an <i>Any<\/i> module.<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use YAML::Any; <br \/> $YAML::Indent = 3; <br \/> my $yaml = Dump(@objects);<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">There are several <small>YAML<\/small> implementations that support the Dump\/Load <small>API.<\/small> This module selects the best one available and uses it.<\/p>\n<h2>ORDER <a name=\"ORDER\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Currently, YAML::Any will choose the first one of these <small>YAML<\/small> implementations that is installed on your system:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"15%\">\n<p><small>YAML::XS<\/small><\/p>\n<\/td>\n<td width=\"68%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"15%\">\n<p>YAML::Syck<\/p>\n<\/td>\n<td width=\"68%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"15%\">\n<p>YAML::Old<\/p>\n<\/td>\n<td width=\"68%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"15%\">\n<p><small>YAML<\/small><\/p>\n<\/td>\n<td width=\"68%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"15%\">\n<p>YAML::Tiny<\/p>\n<\/td>\n<td width=\"68%\"> <\/td>\n<\/tr>\n<\/table>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">If you specify an option like:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">$YAML::Indent = 4;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">And YAML::Any is using <small>YAML::XS,<\/small> it will use the proper variable: $YAML::XS::Indent.<\/p>\n<h2>SUBROUTINES <a name=\"SUBROUTINES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Like all the <small>YAML<\/small> modules that YAML::Any uses, the following subroutines are exported by default:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"6%\">\n<p style=\"margin-top: 1em\">Dump<\/p>\n<\/td>\n<td width=\"77%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"6%\">\n<p>Load<\/p>\n<\/td>\n<td width=\"77%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">and the following subroutines are exportable by request:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"12%\">\n<p style=\"margin-top: 1em\">DumpFile<\/p>\n<\/td>\n<td width=\"71%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"12%\">\n<p>LoadFile<\/p>\n<\/td>\n<td width=\"71%\"> <\/td>\n<\/tr>\n<\/table>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">YAML::Any provides the following class methods. <br \/> &#8220;YAML::Any\u2212>order&#8221;<\/p>\n<p style=\"margin-left:17%;\">This method returns a list of the current possible implementations that YAML::Any will search for.<\/p>\n<p style=\"margin-left:11%;\">&#8220;YAML::Any\u2212>implementation&#8221;<\/p>\n<p style=\"margin-left:17%;\">This method returns the implementation the YAML::Any will use. This result is obtained by finding the first member of YAML::Any\u2212>order that is either already loaded in %INC or that can be loaded using &#8220;require&#8221;. If no implementation is found, an error will be thrown.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>DumpFile and LoadFile<\/b> <br \/> Here is an example for &#8220;DumpFile&#8221;:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">#!\/usr\/bin\/perl <br \/> use strict; <br \/> use warnings; <br \/> use YAML::Any qw(DumpFile); <br \/> my $ds = <br \/> { <br \/> array => [5,6,100], <br \/> string => &#8220;Hello&#8221;, <br \/> }; <br \/> DumpFile(&#8220;hello.yml&#8221;, $ds);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">When run, this creates a file called &#8220;hello.yml&#8221; in the current working directory, with the following contents.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\u2212\u2212\u2212 <br \/> array: <br \/> \u2212 5 <br \/> \u2212 6 <br \/> \u2212 100 <br \/> string: Hello<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In turn, the following &#8220;LoadFile&#8221; example, loads the contents from there and accesses them:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">#!\/usr\/bin\/perl <br \/> use strict; <br \/> use warnings; <br \/> use YAML::Any qw(LoadFile); <br \/> my ($ds) = LoadFile(&#8220;hello.yml&#8221;); <br \/> print &#8220;String == &#8216;&#8221;, $ds\u2212>{string}, &#8220;&#8216;n&#8221;;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Assuming &#8220;hello.yml&#8221; exists, and is as created by the &#8220;DumpFile&#8221; example, it prints:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">$ perl load.pl <br \/> String == &#8216;Hello&#8217; <br \/> $<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Ingy d\u00c3\u00b6t Net <ingy@cpan.org><\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright 2001\u22122014. Ingy d\u00c3\u00b6t Net<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">See <http:\/\/www.perl.com\/perl\/misc\/Artistic.html><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  YAML::Any \u2212 Pick a YAML implementation and use it. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3404],"class_list":["post-7058","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-yamlany"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7058"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7058\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}