YAMASHINA Hio
hio****@users*****
2006年 10月 22日 (日) 20:36:09 JST
Index: docs/modules/YAML-0.62/lib/YAML.pod diff -u /dev/null docs/modules/YAML-0.62/lib/YAML.pod:1.1 --- /dev/null Sun Oct 22 20:36:09 2006 +++ docs/modules/YAML-0.62/lib/YAML.pod Sun Oct 22 20:36:09 2006 @@ -0,0 +1,1165 @@ +=encoding utf-8 + +=head1 åå + +YAML - YAML Ain't Markup Language (tm) + +YAML - YAML Ain't Markup Language (tm) (YAMLã¯ãã¼ã¯ã¢ããè¨èªã§ã¯ããã¾ãã) + +=head1 æ¦è¦ + + use YAML; + + # Load a YAML stream of 3 YAML documents into Perl data structures. + # 3 ã¤ã® YAML ããã¥ã¡ã³ããå«ã YAML ã¹ããªã¼ã ã Perl ãã¼ã¿æ§é ã« + # ãã¼ããã. + my ($hashref, $arrayref, $string) = Load(<<'...'); + --- + name: ingy + age: old + weight: heavy + # I should comment that I also like pink, but don't tell anybody. + # ãã³ã¯ãããã§ãã, ããã¯ç§å¯ã§ã. + favorite colors: + - red + - green + - blue + --- + - Clark Evans + - Oren Ben-Kiki + - Ingy dE<ouml>t Net + --- > + You probably think YAML stands for "Yet Another Markup Language". It + ain't! YAML is really a data serialization language. But if you want + to think of it as a markup, that's OK with me. A lot of people try + to use XML as a serialization format. + + ãããã YAML 㯠"Yet Another Markup Language" ã ã¨æã£ã¦ããã§ãã + ã. ãããããã¯éãã¾ã! YAML ã¯å®éã«ã¯ãã¼ã¿ç´ååè¨èªã§ã. + ããã YAML ããã¼ã¯ã¢ããè¨èªã¨æãããã®ãªããããããã§ããã. + å¤ãã®äººã 㯠XML ãç´ååã®æ¸å¼ã¨ãã¦ä½¿ã£ã¦ãããã¨ã§ãã. + + "YAML" is catchy and fun to say. Try it. "YAML, YAML, YAML!!!" + + "YAML" ã¯è¦ããããè¨ããããã§ã. ã©ãããä¸ç·ã«. + "YAML, YAML, YAML!!!" + ... + + # Dump the Perl data structures back into YAML. + # Perl ãã¼ã¿æ§é ãã YAML ã«ãã³ã. + print Dump($string, $arrayref, $hashref); + + # YAML::Dump is used the same way you'd use Data::Dumper::Dumper + # YAML::Dump 㯠Data::Dumper::Dumper ã¨åãããã«ä½¿ããã¨ãã§ãã¾ã. + use Data::Dumper; + print Dumper($string, $arrayref, $hashref); + +=head1 説æ + +The YAML.pm module implements a YAML Loader and Dumper based on the YAML +1.0 specification. L<http://www.yaml.org/spec/> + +YAML.pm ã¢ã¸ã¥ã¼ã«ã¯ YAML 1.0 ä»æ§ã«åºã¥ã YAML ãã¼ãåã³ãã³ãã¼ã +å®è£ ãã¦ãã¾ã. L<http://www.yaml.org/spec/> + +YAML is a generic data serialization language that is optimized for +human readability. It can be used to express the data structures of most +modern programming languages. (Including Perl!!!) + +YAML ã¯å¯èªæ§ã«åªããæ±ç¨çãªãã¼ã¿ç´åå(ã·ãªã¢ã«å)è¨èªã§ã. +YAML ã¯è¿é ã®ã»ã¨ãã©ã®ããã°ã©ãã³ã°è¨èª(ãã¡ãã Perl ãå«ã¿ã¾ã!!!) +ã®ãã¼ã¿æ§é ã表ç¾ãããã¨ãã§ãã¾ã. + +For information on the YAML syntax, please refer to the YAML +specification. + +YAML ã®æ§æã«ã¤ãã¦ã¯ YAML ä»æ§ãåç §ãã¦ãã ãã. + +=head1 ãªã YAML ã¯ã¯ã¼ã«ãªã®ã + +=over 4 + +=item YAML is readable for people. + +YAML ã¯èªã¿ããã. + +It makes clear sense out of complex data structures. You should find +that YAML is an exceptional data dumping tool. Structure is shown +through indentation, YAML supports recursive data, and hash keys are +sorted by default. In addition, YAML supports several styles of scalar +formatting for different types of data. + +YAML ã¯è¤éãªãã¼ã¿æ§é ã®å¤å´ã®æ確ãªæå³ãä½ãã¾ã. YAML ãç¹å¥ãª +ãã¼ã¿ãã³ããã¼ã«ã§ãããã¨ã«æ°ã¥ãã¹ãã§ããã. ãã¼ã¿æ§é 㯠+ã¤ã³ãã³ããéãã¦è¦æ¸¡ããã, å帰ãã¼ã¿ãæ±ããã¨ãã§ãã¾ã. +ã¾ã, é ç®ãã¼ã¯ããã©ã«ãã§ã½ã¼ãããã¾ã. å ãã¦ãã¼ã¿ã®å½¢å¼ã« +対å¿ããæ§ã ãªç¨®é¡ã®ã¹ã«ã©ã¼å¤ããµãã¼ããã¦ãã¾ã. + +=item YAML is editable. + +YAML ã¯ç·¨éãããã. + +YAML was designed from the ground up to be an excellent syntax for +configuration files. Almost all programs need configuration files, so +why invent a new syntax for each one? And why subject users to the +complexities of XML or native Perl code? + +YAML ã¯è¨å®ãã¡ã¤ã«ã®ç¾ããæ§æããå®å ¨ã«ãã¶ã¤ã³ããã¦ãã¾ã. +ã»ã¨ãã©ãã¹ã¦ã®ããã°ã©ãã¯è¨å®ãã¡ã¤ã«ãå¿ è¦ã¨ãã¦ããã§ããã. +ããã¦ãªãæ¯åæ°ããæ§æãçºæãããã¨ããã®ã§ããï¼ ãªã XML ã® +è¤éãã Perl ã³ã¼ããã®ãã®ã«æ©ã¾ãããªããã°ãªããªãã®ã§ããï¼ + +=item YAML is multilingual. + +YAML ã¯ãã«ããªã³ã¬ã«. + +Yes, YAML supports Unicode. But I'm actually referring to programming +languages. YAML was designed to meet the serialization needs of Perl, +Python, Ruby, Tcl, PHP, Javascript and Java. It was also designed to be +interoperable between those languages. That means YAML serializations +produced by Perl can be processed by Python. + +YAML 㯠Unicode ããµãã¼ããã¦ãã¾ã. ãããå®éã«ã¯ããã°ã©ãã³ã°è¨èªã« +ä»»ããã¦ãã¾ã. YAML 㯠Perl, Python, Ruby, Tcl, PHP, JavaScript, +Java ã®ç´ååã® +å¿ è¦æ§ã«è¦åãããã«è¨è¨ããã¦ãã¾ã. ã¾ããããã®è¨èªéã§ç¸äºã«æä½ +ã§ããããã«è¨è¨ããã¦ãã¾ã. ãã㯠Perl ãçæãã YAML 㯠Python 㧠+å¦çãããã¨ãå¯è½ãªãã¨ãæå³ã, ããã«å®å ¨ãªãã¼ã¿æ§é ãè¿ããã¨ã +ä¿è¨¼ãã¾ã. + +=item YAML is taint safe. + +YAML ã¯æ±æã«å®å ¨. + +Using modules like Data::Dumper for serialization is fine as long as you +can be sure that nobody can tamper with your data files or +transmissions. That's because you need to use Perl's C<eval()> built-in +to deserialize the data. Somebody could add a snippet of Perl to erase +your files. + +ç´ååã®ããã« Data::Dumper ã®æ§ãªã¢ã¸ã¥ã¼ã«ã使ãã¨, ãã¡ã¤ã«ãä¼é路㫠+ã ããå¹²æ¸ã§ããªãéãã«ããã¦ãªãå®å ¨ã§ããã. ããã¯ç´ååãããã¼ã¿ +æ§é ãå±éããã®ã« Perl ã® C<eval()> çµã¿è¾¼ã¿é¢æ°ãå¿ è¦ã¨ãªããã¨ã« +ç±æ¥ãã¾ã. ã ããããã¡ã¤ã«ãåé¤ãã¦ãã¾ããããªæçãå ¥ãã¦ãã¾ãã㨠+ãããããããã¾ãã. + +YAML's parser does not need to eval anything. + +YAML ã®ãã¼ãµã«ã¯ eval ã¯å ¨ãå¿ è¦ã¨ãã¾ãã. + +=item YAML is full featured. + +YAML ã¯å®å ¨ã«æ©è½ãã¾ã. + +YAML can accurately serialize all of the common Perl data structures and +deserialize them again without losing data relationships. Although it is +not 100% perfect (no serializer is or can be perfect), it fares as well +as the popular current modules: Data::Dumper, Storable, XML::Dumper and +Data::Denter. + +YAML ã¯ä¸è¬ç㪠Perl ã®ãã¼ã¿æ§é ãæ£ç¢ºã«ç´ååã, ãã¼ã¿ã®é¢é£ã +失ããã¨ãªãå±éã§ãã¾ã. ã¨ã¯ãã£ã¦ã 100% å®ç§ã«ã¯ãªãã¾ãã(100% +å®ç§ãªã·ãªã¢ã©ã¤ã¶ã¯ããã¾ããã, ã©ããªã·ãªã¢ã©ã¤ã¶ã 100% å®ç§ã«ã¯ +ãªãã¾ãã), Data::Dumper, Storable, XML::Dumper, Data::Denter ãªã©ã +åæ§ã§ã. + +YAML.pm also has the ability to handle code (subroutine) references and +typeglobs. (Still experimental) These features are not found in Perl's +other serialization modules. + +YAML.pm ã¯ã³ã¼ã(ãµãã«ã¼ãã£ã³)ãªãã¡ã¬ã³ã¹ãã¿ã¤ãã°ã©ããå¦çãã +ãã¨ãã§ãã¾ã. (ã¾ã å®é¨çãªãã®ã§ãã.) ãããã®æ©è½ã¯ Perl ã® +ä»ã®ã·ãªã¢ã©ã¤ã¼ã¼ã·ã§ã³ã¢ã¸ã¥ã¼ã«ã«ã¯ãªãæ©è½ã§ã. + +=item YAML is extensible. + +YAML ã¯æ¡å¼µå¯è½ã§ã. + +The YAML language has been designed to be flexible enough to solve it's +own problems. The markup itself has 3 basic construct which resemble +Perl's hash, array and scalar. By default, these map to their Perl +equivalents. But each YAML node also supports a tagging mechanism (type +system) which can cause that node to be interpreted in a completely +different manner. That's how YAML can support object serialization and +oddball structures like Perl's typeglob. + +YAML è¨èªã¯ããèªèº«ã®åé¡ã解決ããã®ã«ååæè»ã«ãã¶ã¤ã³ããã¦ãã¾ã. +èªåèªèº«ã®è¨è¿°ã«ã¯ Perl ã®ããã·ã¥, é å, ã¹ã«ã©ã¼ã¨ä¼¼ãï¼ã¤ã®åºæ¬ç㪠+æ§é ãããã¾ã. ããã©ã«ãã§ã¯ããã㯠Perl ã§ç価ã«å¯¾å¿ãã¾ã. +ãããå YAML ãã¼ãã¯å®å ¨ã«ç°ãªãä½æ³ã§å¦çããããã®, ã¿ã°ä»ã +(åã¯ã¿ã¤ãã·ã¹ãã )ããµãã¼ããã¦ãã¾ã. YAML 㯠Perl ã®åã°ãã +ã®æ§ãªå¤ãã£ãæ§é ããµãã¼ããããã¨ãã§ãã¾ã. + +=back + +=head1 Perl ã§ã® YAML ã®å®è£ + +This module, YAML.pm, is really just the interface module for YAML +modules written in Perl. The basic interface for YAML consists of two +functions: C<Dump> and C<Load>. The real work is done by the modules +YAML::Dumper and YAML::Loader. + +ãã®ã¢ã¸ã¥ã¼ã«, YAML.pm ã¯å®éã«ã¯ Perl ã§ã® YAML ã¢ã¸ã¥ã¼ã«ã® +ã¤ã³ã¿ã¼ãã§ã¼ã¹ã§ããããã¾ãã. YAML ã®åºæ¬çãªã¤ã³ã¿ã¼ãã§ã¼ã¹ +ã¯ï¼ã¤ã®é¢æ°, C<Dump> åã³ C<Load> ããæãã¾ã. +ãã®å®éã®åä½ã¯ YAML::Dumper åã³ YAML::Loader ã¢ã¸ã¥ã¼ã«ã§ +å®è£ ããã¦ãã¾ã. + +Different YAML module distributions can be created by subclassing +YAML.pm and YAML::Loader and YAML::Dumper. For example, YAML-Simple +consists of YAML::Simple YAML::Dumper::Simple and YAML::Loader::Simple. + +ç°ãªã YAML ã¢ã¸ã¥ã¼ã«ã®é å¸ç©ã§ã¯ YAML.pm, YAML::Loader, +YAML::Dumper ããµãã¯ã©ã¹åãã¦ä½ããã¨ãåºæ¥ã¾ã. +ä¾ãã° YAML-Simple ã¯, YAML::Simple, YAML::Dumper::Simple, +YAM::Loader::Simple ããæãã¾ã. + +Why would there be more than one implementation of YAML? Well, despite +YAML's offering of being a simple data format, YAML is actually very +deep and complex. Implementing the entirety of the YAML specification is +a daunting task. + +ã©ãã㦠YAML ã®å®è£ ãï¼ã¤ã ããããªãã®ãã£ã¦ï¼ +YAML ã¯ã·ã³ãã«ãªãã¼ã¿å½¢å¼ã§ãããã¨ææ¡ãã¦ããã®ã§ãã, +å®éã®ã¨ããæ·±ãè¤éã§ã. YAML ã®ä»æ§ãå®å ¨ã«å®è£ ããã®ã¯ +ã²ã©ã大å¤ãªãã¨ãªã®ã§ã. + +For this reason I am currently working on 3 different YAML implementations. + +ãããªäºæ ãã, ç§ã¯ç¾å¨ï¼ã¤ã®ç°ãªã YAML å®è£ ã使ã£ã¦ãã¾ã. + +=over + +=item YAML + +The main YAML distribution will keeping evolving to support the entire +YAML specification in pure Perl. This may not be the fastest or most +stable module though. Currently, YAML.pm has lots of known bugs. It is +mostly a great tool for dumping Perl data structures to a readable form. + +ã¡ã¤ã³ã® YAML ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã§, ãã¥ã¢ Perl ã§ã® +å®å ¨ãª YAML ä»æ§ã®ãµãã¼ããè¡ã£ã¦ãã¾ã. ããã, +ä¸çªé«éã¨ãããã§ãä¸çªå®å®ãã¦ããã¨ããããã§ãããã¾ãã. +ç¾å¨ã§ã, YAML.pm ã«ã¯å¤ãã®æ¢ç¥ã®ãã°ãæ®ã£ã¦ãã¾ã. +ã¨ã¯ãã Perl ã®ãã¼ã¿æ§é ãèªã¿ãããå½¢å¼ã«åºåãã +ä¸çªåªãããã¼ã«ã§ããã. + +=item YAML::Lite + +The point of YAML::Lite is to strip YAML down to the 90% that people +use most and offer that in a small, fast, stable, pure Perl form. +YAML::Lite will simply die when it is asked to do something it can't. + +YAML::Lite ã®ã¢ãã¼ã«ãã¤ã³ãã¯, 人ã ãå¤ãå©ç¨ãã, +ããã¦å°ãã, éã, å®å®ãã, ãã¥ã¢Perlå½¢å¼ã¨ãã¦ææ¡ããã ãã«, +YAML ã 90% ã«è½ã¨ãã¦ããç¹ã«ããã¾ã. + +=item YAML::Syck + +C<libsyck> is the C based YAML processing library used by the Ruby +programming language (and also Python, PHP and Pugs). YAML::Syck is the +Perl binding to C<libsyck>. It should be very fast, but may have +problems of its own. It will also require C compilation. + +C<libsyck> ã¨ãã, Ruby ããã°ã©ãã³ã°è¨èª(ãã㦠Python, PHP, Pugs +ã§ã)使ããã¦ãã C è¨èªãã¼ã¹ã® YAML å¦çã©ã¤ãã©ãªãããã¾ã. +ããã¯ã¨ã¦ãé«éã§ãã, ããèªèº«ã®ãã°ãããã¾ã. ã¾ã, +C ã³ã³ãã¤ã©ãå¿ è¦ã«ãªãã¾ã. + +NOTE: Audrey Tang has actually completed this module and it works great + and is 10 times faster than YAML.pm. + +è£è¶³: Audrey Tang ããã®ã¢ã¸ã¥ã¼ã«ãå®è³ªå®æãã, ãã°ãããåä½ã§ãã +ã¨åæã« YAML.pm ããï¼ï¼åé«éã§ã. + +=back + +In the future, there will likely be even more YAML modules. Remember, +people other than Ingy are allowed to write YAML modules! + +ä»å¾, ããå¤ãã® YAML ã¢ã¸ã¥ã¼ã«ãåºã¦ããã§ããã. +Ingy 以å¤ã®äººã ã§ã YAML ã¢ã¸ã¥ã¼ã«ãæ¸ããã¨ãã§ãããã¨ã +æãåºãã¦ãã ãã! + +=head1 é¢æ°ã®ä½¿ãæ¹ + +YAML is completely OO under the hood. Still it exports a few useful top +level functions so that it is dead simple to use. These functions just +do the OO stuff for you. If you want direct access to the OO API see the +documentation for YAML::Dumper and YAML::Loader. + +YAML ã¯æ°´é¢ä¸ã§ã¯å®å ¨ã«ãªãã¸ã§ã¯ãæåã«ãªã£ã¦ãã¾ã. +å¹¾ã¤ãã®ä¾¿å©ãªãããã¬ãã«é¢æ°ãã¨ã¯ã¹ãã¼ããã¦ãã, ãã®ä½¿ãæ¹ã¯ +ã¨ã¦ãç°¡åã§ã. ãããã®é¢æ°ã¯ããªãã«å¤ãã£ã¦ãªãã¸ã§ã¯ãæä½ã +è¡ã£ã¦ããã ãã§ã. ãããªãã¸ã§ã¯ãAPIã«ç´æ¥ã¢ã¯ã»ã¹ãããã¨ãã¯, +YAML::Dumper åã³ YAML::Loader ã®åçé¢mã¨ãåç §ãã¦ãã ãã. + +=head2 ã¨ã¯ã¹ãã¼ããããé¢æ°. + +The following functions are exported by YAML.pm by default. The reason +they are exported is so that YAML works much like Data::Dumper. If you +don't want functions to be imported, just use YAML with an empty +import list: + +YAML.pm ããã¯ä»¥ä¸ã®é¢æ°ãããã©ã«ãã§ã¨ã¯ã¹ãã¼ãããã¾ã. +ããããã¨ã¯ã¹ãã¼ãããããã¨ã§, YAML 㯠Data::Dumper ã¨åãããã« +åä½ãã¾ã. ããé¢æ°ã®ã¤ã³ãã¼ããå¿ è¦ãªããã°, +空ã®ã¤ã³ãã¼ããªã¹ã㧠use YAML ãã¦ãã ãã: + + use YAML (); + +=over 4 + +=item Dump(list-of-Perl-data-structures) + +Dump(Perlãã¼ã¿æ§é ã®ãªã¹ã) + +Turn Perl data into YAML. This function works very much like +Data::Dumper::Dumper(). It takes a list of Perl data strucures and +dumps them into a serialized form. It returns a string containing the +YAML stream. The structures can be references or plain scalars. + +Perl ãã¼ã¿ã YAML ã«å¤æãã¾ã. ãã®é¢æ°ã¯ Data::Dumper::Dumper() 㨠+ã¨ã¦ãåãããã«åä½ãã¾ã. Perl ãã¼ã¿æ§é ã®ãªã¹ããåãåã, ããã +ã·ãªã¢ã«åããå½¢å¼ã«ãã³ããã¾ã. YAML ã¹ããªã¼ã ãæååã¨ãã¦è¿ãã¾ã. +ãªãã¡ã¬ã³ã¹ãããã¯ã¹ã«ã©ã¼ãåãåããã¨ãã§ãã¾ã. + +=item Load(string-containing-a-YAML-stream) + +Load(YAMLã¹ããªã¼ã ãæ ¼ç´ããæåå) + +Turn YAML into Perl data. This is the opposite of Dump. Just like +Storable's thaw() function or the eval() function in relation to +Data::Dumper. It parses a string containing a valid YAML stream into a +list of Perl data structures. + +YAML ã Perl ãã¼ã¿ã«å¤æãã¾ã. ãã㯠Dump ã®å¯¾ã§ã. Storable ã® +thaw() é¢æ°ã, Data::Dumper ã§ã® eval() ã«ç¸å½ãã¾ã. +é©æ£ãª YAML ã¹ããªã¼ã ã Perl ãã¼ã¿æ§é ã®ãªã¹ãã«å±éãã¾ã. + +=back + +=head2 ã¨ã¯ã¹ãã¼ãå¯è½ãªé¢æ° + +These functions are not exported by default but you can request them in +an import list like this: + +ãããã®é¢æ°ã¯ããã©ã«ãã§ã¯ã¨ã¯ã¹ãã¼ãããã¾ããã, 次ã®ããã« +æå®ãããã¨ãã§ãã¾ã: + + use YAML qw'freeze thaw Bless'; + +=over 4 + +=item freeze() and thaw() + +Aliases to Dump() and Load() for Storable fans. This will also allow +YAML.pm to be plugged directly into modules like POE.pm, that use the +freeze/thaw API for internal serialization. + +Storable ã®ãã¡ã³ã®ããã«, Dump() 㨠Load() ã®å¥åã§ã. +ããã«ãã£ã¦ POE.pm ã®ãããªå é¨ã®ç´ååã« freeze/thaw API ã +使ã£ã¦ããã¢ã¸ã¥ã¼ã«ã§ YAML.pm ãç´æ¥å©ç¨ãããã¨ãåºæ¥ã¾ã. + +=item DumpFile(filepath, list) + +Writes the YAML stream to a file instead of just returning a string. + +æååã¨ãã¦è¿ã代ããã« YAML ã¹ããªã¼ã ããã¡ã¤ã«ã«åºå. + +=item LoadFile(filepath) + +Reads the YAML stream from a file instead of a string. + +æååã¨ãã¦æ¸¡ã代ããã«ãã¡ã¤ã«ãã YAML ã¹ããªã¼ã ãèªè¾¼. + +=item Bless(perl-node, [yaml-node | class-name]) + +Associate a normal Perl node, with a yaml node. A yaml node is an object +tied to the YAML::Node class. The second argument is either a yaml node +that you've already created or a class (package) name that supports a +yaml_dump() function. A yaml_dump() function should take a perl node and +return a yaml node. If no second argument is provided, Bless will create +a yaml node. This node is not returned, but can be retrieved with the +Blessed() function. + +é常㮠Perl ã®ãã¼ãã« yaml ã®ãã¼ããé¢é£ã¥ãã¾ã. yaml ãã¼ã㯠+YAML::Node ã¯ã©ã¹ã« tie ããããªãã¸ã§ã¯ãã§ã. ï¼ã¤ç®ã®å¼æ°ã¯æ¢åã® yaml +ãã¼ãã yaml_dump() é¢æ°ããµãã¼ããã¦ããã¯ã©ã¹å(ããã±ã¼ã¸å)ã§ã. +yaml_dump() é¢æ°ã¯ perl ãã¼ããåãåã yaml ãã¼ããè¿ãã¹ãã§ã. +ããï¼ã¤ç®ã®å¼æ°ãçç¥ãããã¨ãã«ã¯ Bless é¢æ°ã¯ yaml ãã¼ããä½æãã¾ã. +ä½æããããã¼ãã¯è¿ããã¾ããã, Blessed() é¢æ°ã§åãåããã¨ãã§ãã¾ã. + +Here's an example of how to use Bless. Say you have a hash containing +three keys, but you only want to dump two of them. Furthermore the keys +must be dumped in a certain order. Here's how you do that: + +Bless ã®ä½¿ãæ¹ã®ä¾ãæãã¦ããã¾ã. ï¼ã¤ã®ãã¼ãæã¤ããã·ã¥ãæã£ã¦ãã +ããã©, ãã®ãã¡ï¼ã¤ã ãããã³ããããã¨ãã¾ã. ããã«ãã¼ãç¹å®ã®é åºã§ +並ã¹ããã¨ãã¾ã. ãããªã¨ãã¯æ¬¡ã®ããã«ãã¾ã: + + use YAML qw(Dump Bless); + $hash = {apple => 'good', banana => 'bad', cauliflower => 'ugly'}; + print Dump $hash; + Bless($hash)->keys(['banana', 'apple']); + print Dump $hash; + +produces: + +åºåçµæã¯æ¬¡ã®ããã«ãªãã¾ã: + + --- + apple: good + banana: bad + cauliflower: ugly + --- + banana: bad + apple: good + +Bless returns the tied part of a yaml-node, so that you can call the +YAML::Node methods. This is the same thing that YAML::Node::ynode() +returns. So another way to do the above example is: + +Bless 㯠yaml ãã¼ãã® tie ãããé¨åãè¿ãã¾ã. å¾ã£ã¦ YAML::Node ã® +ã¡ã½ãããå¼ã¶ãã¨ãã§ãã¾ã. ãã㯠YAML::Node::ynode() ãè¿ã +ãã®ã¨åããã®ã§ã. ã¤ã¾ãããã¨åããã¨ã次ã®ããã«ãè¡ãã¾ã: + + use YAML qw(Dump Bless); + use YAML::Node; + $hash = {apple => 'good', banana => 'bad', cauliflower => 'ugly'}; + print Dump $hash; + Bless($hash); + $ynode = ynode(Blessed($hash)); + $ynode->keys(['banana', 'apple']); + print Dump $hash; + +Note that Blessing a Perl data structure does not change it anyway. The +extra information is stored separately and looked up by the Blessed +node's memory address. + +Perl ãã¼ã¿æ§é ã¸ã® Bless ã¯, ãã®ãã¼ã¿ãä½ãå¤æ´ãã¾ãã. +追å ã®æ å ±ã¯å¥ã«ä¿æãã, Bless ããããã¼ãã®ã¡ã¢ãªã¢ãã¬ã¹ +ããæ¢ç´¢ããã¾ã. + +=item Blessed(perl-node) + +Returns the yaml node that a particular perl node is associated with +(see above). Returns undef if the node is not (YAML) Blessed. + +perl ãã¼ãã¨é¢é£ã¥ãããã¦ãã yaml ãã¼ããè¿ãã¾ã(ä¸ãåç §). +ãã¼ãã (YAMLã§) bless ããã¦ããªããã° undef ãè¿ãã¾ã. + +=back + +=head1 ã°ãã¼ãã«ãªãã·ã§ã³ + +YAML options are set using a group of global variables in the YAML +namespace. This is similar to how Data::Dumper works. + +YAML ãªãã·ã§ã³ã¯ YAML åå空éã®ã°ãã¼ãã«å¤æ°ã使ã£ã¦è¨å®ãããã¨ã +ã§ãã¾ã. ãã㯠Data::Dumper ã®åä½ã¨ä¼¼ã¦ãã¾ã. + +For example, to change the indentation width, do something like: + +ä¾ãã°ã¤ã³ãã³ãå¹ ãå¤ãããã¨ãã«ã¯æ¬¡ã®ããã«ãã¾ã: + + local $YAML::Indent = 3; + +The current options are: + +ç¾å¨è¨å®ã§ãããªãã·ã§ã³ã«ã¯ä»¥ä¸ã®ãã®ãããã¾ã: + +=over 4 + +=item DumperClass + +You can override which module/class YAML uses for Dumping data. + +YAML ããã¼ã¿ã® Dump ã«ä½¿ãã¢ã¸ã¥ã¼ã«/ã¯ã©ã¹ãä¸æ¸ãã§ãã¾ã. + +=item LoaderClass + +You can override which module/class YAML uses for Loading data. + +YAML ããã¼ã¿ã® Load ã«ä½¿ãã¢ã¸ã¥ã¼ã«/ã¯ã©ã¹ãä¸æ¸ãã§ãã¾ã. + +=item Indent + +This is the number of space characters to use for each indentation level +when doing a Dump(). The default is 2. + +Dump() æã«ã¤ã³ãã³ãã«ä½¿ãæåå¹ ãæ°å¤ã§æå®ãã¾ã. ããã©ã«ãã§ã¯ 2 +ã§ã. + +By the way, YAML can use any number of characters for indentation at any +level. So if you are editing YAML by hand feel free to do it anyway that +looks pleasing to you; just be consistent for a given level. + +ã¤ãã§ã«, YAML ã¯ä»»æã®ã¬ãã«ã§ä»»æã®æ°ã®ã¤ã³ãã³ã空ç½æåã使ããã¨ã +ã§ãã¾ã. ãã YAML ãæã§ç·¨éãã¦ããã®ãªãã¬ãã«ã«çç¾ããªãç¯å²ã§ +æºè¶³ã®ããããã«èªç±ã«ã¤ã³ãã³ãã§ãã¾ã. + +=item SortKeys + +Default is 1. (true) + +ããã©ã«ã㯠1 (ç) ã§ã. + +Tells YAML.pm whether or not to sort hash keys when storing a document. + +YAML.pm ãããã¥ã¡ã³ãã®æ ¼ç´æã«ã¯ã£ä¸»ãã¼ãã½ã¼ããããã©ããã +è¨å®ãã¾ã. + +YAML::Node objects can have their own sort order, which is usually what +you want. To override the YAML::Node order and sort the keys anyway, set +SortKeys to 2. + +YAML::Node ãªãã¸ã§ã¯ãã¯ç¬èªã®ä¸¦ã³é ãæã¤ãã¨ãã§ãã¾ã. YAML::Node ã® +é åºãä¸æ¸ããã¦å¸¸ã«ã½ã¼ããããã«ã¯ SortKeys ã« 2 ãè¨å®ãã¦ãã ãã. + +=item Stringify + +Default is 0. (false) + +ããã©ã«ã㯠0 (å½) ã§ã. + +Objects with string overloading should honor the overloading and dump the +stringification of themselves, rather than the actual object's guts. + +æååã®ãªã¼ãã¼ãã¼ããè¡ã£ã¦ãããªãã¸ã§ã¯ãã¯, ãªãã¸ã§ã¯ãã®å®éã®å 容 +ã§ã¯ãªã, ãªã¼ãã¼ãã¼ãããã¦ãããã¨ãåãå ¥ãã¦, ããèªèº«ã® +æåååããããã®ããã³ããããã¹ãã§ã. + +=item UseHeader + +Default is 1. (true) + +ããã©ã«ã㯠1 (ç) ã§ã. + +This tells YAML.pm whether to use a separator string for a Dump +operation. This only applies to the first document in a stream. +Subsequent documents must have a YAML header by definition. + +YAML.pm ã Dump æä½ã®ããã®ã»ãã¬ã¼ã¿æååã使ããã©ãããè¨å®ãã¾ã. +ããã¯ã¹ããªã¼ã ä¸ã®æåã®ããã¥ã¡ã³ãã«ç¨ããããã ãã§ã. +ãã以éã®ããã¥ã¡ã³ãã§ã¯ YAML ããããæããªããã°ãªããªã㨠+å®ç¾©ããã¦ãã¾ã. + +=item UseVersion + +Default is 0. (false) + +ããã©ã«ã㯠0 (å½) ã§ã. + +Tells YAML.pm whether to include the YAML version on the +separator/header. + +YAML.pm ãã»ãã¬ã¼ã¿/ãããã« YAML ãã¼ã¸ã§ã³ãå«ãããã©ããã +è¨å®ãã¾ã. + + --- %YAML:1.0 + +=item AnchorPrefix + +Default is ''. + +ããã©ã«ãã§ã¯ '' ã§ã. + +Anchor names are normally numeric. YAML.pm simply starts with '1' and +increases by one for each new anchor. This option allows you to specify a +string to be prepended to each anchor number. + +ã¢ã³ã«ã¼åã¯é常æ°å¤ã§ã. YAML.pm ã§ã¯åç´ã« '1' ããéå§ã, åã¢ã³ã«ã¼ +æ¯ã«å¢å ããã¦ããã¾ã. ãã®ãªãã·ã§ã³ã§ã¯åã¢ã³ã«ã¼çªå·ã®åã«ã¤ãã +æååãæå®ãããã¨ãã§ãã¾ã. + +=item UseCode + +Setting the UseCode option is a shortcut to set both the DumpCode and +LoadCode options at once. Setting UseCode to '1' tells YAML.pm to dump +Perl code references as Perl (using B::Deparse) and to load them back +into memory using eval(). The reason this has to be an option is that +using eval() to parse untrusted code is, well, untrustworthy. + +UseCode ãªãã·ã§ã³ã¯ DumpCode 㨠LoadCode ã®ï¼ã¤ã®ãªãã·ã§ã³ãä¸åº¦ã« +è¨å®ããã·ã§ã¼ãã«ããã§ã. UseCode ã« '1' ãè¨å®ãã㨠YAML.pm 㯠+Perl ã³ã¼ããªãã¡ã¬ã³ã¹ã(B::Deparseãã¤ãã£ã¦) Perl ã§, ãã㦠+ã¡ã¢ãªä¸ã«ãã¼ãããã¨ãã«ã¯ eval() ã使ãã¾ã. ãã®çµæ, ä¿¡é ¼ã§ããªã +ã³ã¼ãããã¼ã¹ããããã« eval() ã使ããã¨ã«ãªãã¾ã. + +=item DumpCode + +Determines if and how YAML.pm should serialize Perl code references. By +default YAML.pm will dump code references as dummy placeholders (much +like Data::Dumper). If DumpCode is set to '1' or 'deparse', code +references will be dumped as actual Perl code. + +YAML.pm ã Perl ã³ã¼ããªãã¡ã¬ã³ã¹ãã·ãªã¢ã©ã¤ãºããããè¨å®ãã¾ã. +ããã©ã«ãã§ã¯ YAML.pm ã¯ã³ã¼ããªãã¡ã¬ã³ã¹ãããã¼ã®ãã¬ã¼ã¹ãã«ã +ã¨ãã¦ãã³ããã¾ã (ãã㯠Data::Dumper ã¨ããä¼¼ã¦ãã¾ã). +ãã DumpCode ã« '1' ããã㯠'deparse' ãè¨å®ãã¦ããã®ãªã, +ã³ã¼ããªãã¡ã¬ã³ã¹ã¯å®éã® Perl ã³ã¼ãã¨ãã¦ãã³ããããããã«ãªãã¾ã. + +DumpCode can also be set to a subroutine reference so that you can +write your own serializing routine. YAML.pm passes you the code ref. You +pass back the serialization (as a string) and a format indicator. The +format indicator is a simple string like: 'deparse' or 'bytecode'. + +DumpCode ã«ã¯ç¬èªã«ã·ãªã¢ã©ã¤ãºå¦çãè¨è¿°ããé¢æ°ãªãã¡ã¬ã³ã¹ã +è¨å®ãããã¨ãã§ãã¾ã. YAML.pm ã¯ã³ã¼ããªãã¡ã¬ã³ã¹ã渡ãã¦ãã¾ã. +é¢æ°ããã¯ã·ãªã¢ã©ã¤ãºããæååã¨ãã©ã¼ãããæ示åãè¿ãã¾ã. +ãã©ã¼ãããæ示å㯠'deparse' ã 'bytecode' ã¨ãã£ãç°¡åãªæååã§ã. + +=item LoadCode + +LoadCode is the opposite of DumpCode. It tells YAML if and how to +deserialize code references. When set to '1' or 'deparse' it will use +C<eval()>. Since this is potentially risky, only use this option if you +know where your YAML has been. + +LoadCode 㯠DumpCode ã®å¯¾ã§ã. YAML ã«ã³ã¼ããªãã¡ã¬ã³ã¹ã +ãã·ãªã¢ã©ã¤ãºãããã©ãã, ã©ã®ããã«ãã·ãªã¢ã©ã¤ãºããã®ããä¼ãã¾ã. +'1' ããã㯠'deparse' ã¨è¨å®ãã㨠C<eval()> ãè¡ãã¾ã. ããã«ã¯ +æ½å¨çãªãªã¹ã¯ãè² ããã¨ã«ãªãã¾ã. ãã®ãªãã·ã§ã³ã¯ YAML ã®åä½ã +ããç¥ã£ã¦ããå ´æã§ã®ã¿ä½¿ãã¹ãã§ã. + +LoadCode can also be set to a subroutine reference so that you can write +your own deserializing routine. YAML.pm passes the serialization (as a +string) and a format indicator. You pass back the code reference. + +LoadCode ã«ã¯ç¬èªã«ã·ãªã¢ã©ã¤ãºå¦çãè¨è¿°ããé¢æ°ãªãã¡ã¬ã³ã¹ã +è¨å®ãããã¨ãã§ãã¾ã. YAML.pm ã¯ã·ãªã¢ã©ã¤ãºããã¦ããæåå㨠+ãã©ã¼ãããæ示åã渡ãã¦ãã¾ã. é¢æ°ããã¯ã³ã¼ããªãã¡ã¬ã³ã¹ãè¿ãã¾ã. + +=item UseBlock + +YAML.pm uses heuristics to guess which scalar style is best for a given +node. Sometimes you'll want all multiline scalars to use the 'block' +style. If so, set this option to 1. + +YAML.pm ãä¸ãããããã¼ãã«å¯¾ãã¦æé©ãªã¹ã«ã©ã¼å½¢å¼ãæ¨æ¸¬ããã®ã +å©ããããã«ä½¿ãã¾ã. å ¨ã¦ã®è¤æ°è¡ã®ã¹ã«ã©ã¼ã¯'ãããã¯'å½¢å¼ã¨ã㦠+æ±ãããã¨ãã«ã¯ãã®ãªãã·ã§ã³ã« 1 ãè¨å®ãã¾ã. + +NOTE: YAML's block style is akin to Perl's here-document. + +è£è¶³: YAML ã®ãããã¯å½¢å¼ã¯ Perl ã®ãã¢ããã¥ã¡ã³ãã¨åãæ§ãªç©ã§ã. + +=item UseFold + +If you want to force YAML to use the 'folded' style for all multiline +scalars, then set $UseFold to 1. + +è¤æ°è¡ã®ã¹ã«ã©ã¼ã« 'æãããã¿' å½¢å¼ãå¼·å¶ãããã¨ãã«ã¯ +$UseFold ã« 1 ãè¨å®ãã¾ã. + +NOTE: YAML's folded style is akin to the way HTML folds text, + except smarter. + +è£è¶³: YAML ã®æãããã¿å½¢å¼ã¯ããã¹ãã¼ãã§ããç¹ãé¤ãã° +HTML ã®æãããã¿ããã¹ãã¨ä¼¼ãæ§ãªç©ã§ã. + +=item UseAliases + +YAML has an alias mechanism such that any given structure in memory gets +serialized once. Any other references to that structure are serialized +only as alias markers. This is how YAML can serialize duplicate and +recursive structures. + +YAML ã«ã¯ã¡ã¢ãªä¸ã«ããä¸ããããæ§é ãããä¸åº¦ã·ãªã¢ã©ã¤ãºãã +ã¨ã¤ãªã¢ã¹ã¡ã«ããºã ãæã£ã¦ãã¾ã. ãã®æ§é ã¸ã®ä»ã®ãªãã¡ã¬ã³ã¹ã¯ +ã¨ã¤ãªã¢ã¹ãã¼ã«ã¼ã¨ãã¦ã®ã¿ã·ãªã¢ã©ã¤ãºããã¾ã. ããã YAML ã +æ§é ä½ã®è¤è£½ãå帰ãã·ãªã¢ã©ã¤ãºããæ¹æ³ã§ã. + +Sometimes, when you KNOW that your data is nonrecursive in nature, you +may want to serialize such that every node is expressed in full. (ie as +a copy of the original). Setting $YAML::UseAliases to 0 will allow you +to do this. This also may result in faster processing because the lookup +overhead is by bypassed. + +æã«ã¯ãã¼ã¿ãå帰ã§ãªãæ¹ãèªç¶ã§ããã°, ãã¹ã¦ã®ãã¼ãã¯ãã¹ã¦ +表ç¾ããã¦ã»ããã§ããã. (ããªãã¡å ã®ã³ãã¼ã¨ãã¦.) +$YAML::UseAliases ã« 0 ãè¨å®ãããã¨ã§ãããè¡ããã¨ãã§ãã¾ã. +ããã¯æ¤ç´¢ã®ãªã¼ãã¼ããããã¨ã°ããã¨ãã§ããããå¦çã +æ©ããªããã¨ãããã§ããã. + +THIS OPTION CAN BE DANGEROUS. *If* your data is recursive, this option +*will* cause Dump() to run in an endless loop, chewing up your computers +memory. You have been warned. + +B<ãã®ãªãã·ã§ã³ã¯å±éºã§ãããã¾ã.> *ãã* ãã¼ã¿ãå帰ãã¦ããã, +ãã®ãªãã·ã§ã³ã¯ Dump() ãç¡éã«ã¼ãããã¦ãã¾ã, ã¡ã¢ãªã +å°ãå°½ããã¦ãã¾ã*ã§ããã*. åå注æãã¦ãã ãã. + +=item CompressSeries + +Default is 1. + +ããã©ã«ã㯠1 ã§ã. + +Compresses the formatting of arrays of hashes: + +ããã·ã¥ã®é åã®æ¸å¼ãè©°ãã¾ã: + + - + foo: bar + - + bar: foo + +becomes: + +ããã¯æ¬¡ã®ããã«ãªãã¾ã: + + - foo: bar + - bar: foo + +Since this output is usually more desirable, this option is turned on by +default. + +ãã®åºåã¯ããã¦ãæã¾ããã®ã§ããã©ã«ãã§æå¹ã«ãªã£ã¦ãã¾ã. + +=back + +=head1 YAML ç¨èª + +YAML is a full featured data serialization language, and thus has its +own terminology. + +YAML ã¯å®å ¨ãªæ©è½ãæã£ããã¼ã¿ç´ååè¨èªã§ã. +ãã®ããç¬èªã®ç¨èªãæã£ã¦ãã¾ã. + +It is important to remember that although YAML is heavily influenced by +Perl and Python, it is a language in its own right, not merely just a +representation of Perl structures. + +YAML 㯠Perl 㨠Python ã®å½±é¿ãå¼·ãåãã¦ã¾ãã, åã« Perl ã®æ§é ã +表ç¾ããã®ã§ã¯ãªã, ããèªèº«ã®å²å¦ãæã¤è¨èªã§ããã¨ãããã¨ã¯ +ã¨ã¦ãéè¦ãªãã¨ã§ã. + +YAML has three constructs that are conspicuously similar to Perl's hash, +array, and scalar. They are called mapping, sequence, and string +respectively. By default, they do what you would expect. But each +instance may have an explicit or implicit tag (type) that makes it +behave differently. In this manner, YAML can be extended to represent +Perl's Glob or Python's tuple, or Ruby's Bigint. + +YAML ã¯é¡èã« Perl ã®ããã·ã¥, é å, ã¹ã«ã©ã¼ã¨ä¼¼ã¦ãã +ï¼ã¤ã®æ§é ãæã£ã¦ãã¾ã. ãããã¯ãããããããã³ã°, ã·ã¼ã±ã³ã¹, +æååã¨å¼ã°ãã¾ã. ããã©ã«ãã§ã¯, æå³ããã¨ããã«ãªã£ã¦ãã +ã§ããã. ãããåã ã®è¦ç´ ã¯ç°ãªãæ¯ãèãããããããã®æ示çã¾ã㯠+æé»çãªã¿ã°(ã¿ã¤ã)ãæã£ã¦ãã¾ã. ãã®ããã«ã㦠YAML 㯠+Perl ã®ã°ãã, Python ã®ã¿ãã«, Ruby ã® Bigint ã表ç¾ã§ããããã« +æ¡å¼µãããã¨ãã§ãã¾ã. + +=over 4 + +=item stream + +ã¹ããªã¼ã + +A YAML stream is the full sequence of unicode characters that a YAML +parser would read or a YAML emitter would write. A stream may contain +one or more YAML documents separated by YAML headers. + +YAML ã¹ããªã¼ã ã¨ã¯ YAML ãã¼ã¶ãèªã¿è¾¼ãè¥ãã㯠YAML çæå¨ã +æ¸ãåºãã¦ãã³ã¼ãæååã®éåã§ã. ã¹ããªã¼ã ã«ã¯ +YAML ãããã§åºåãããï¼ã¤ä»¥ä¸ã® YAML ããã¥ã¡ã³ããå«ã¾ã㦠+ããã§ããã. + + --- + a: mapping + foo: bar + --- + - a + - sequence + +=item document + +ããã¥ã¡ã³ã + +A YAML document is an independent data structure representation within a +stream. It is a top level node. Each document in a YAML stream must +begin with a YAML header line. Actually the header is optional on the +first document. + +YAML ããã¥ã¡ã³ãã¨ã¯ã¹ããªã¼ã ããç¬ç«ãããã¼ã¿æ§é 表ç¾ã§ã. +ãããã¬ãã«ã®ãã¼ãã«ãªãã¾ã. YAML ã¹ããªã¼ã ã«ããããããã® +ããã¥ã¡ã³ã㯠YAML ãããè¡ããå§ã¾ããªããã°ãªãã¾ãã. å®éã«ã¯ +æåã®ããã¥ã¡ã³ãã«é¢ãã¦ã¯ãããã¯çç¥å¯è½ã§ã. + + --- + This: top level mapping + is: + - a + - YAML + - document + +=item header + +ããã + +A YAML header is a line that begins a YAML document. It consists of +three dashes, possibly followed by more info. Another purpose of the +header line is that it serves as a place to put top level tag and anchor +information. + +YAML ãããã¨ã¯ YAML ããã¥ã¡ã³ãã®éå§ã示ãè¡ã§ã. ï¼ã¤ã®ããã·ã¥ã¨, +ãããã追å ã®æ å ±ãããªãã§ããã. ãããè¡ã®ããï¼ã¤ã®ç®çã¯ããã +ã¬ãã«ã®ã¿ã°ã¨ã¢ã³ã«ã¼æ å ±ãç½®ãå ´æãæä¾ãããã¨ã§ã. + + --- !recursive-sequence &001 + - * 001 + - * 001 + +=item node + +ãã¼ã + +A YAML node is the representation of a particular data stucture. Nodes +may contain other nodes. (In Perl terms, nodes are like scalars. +Strings, arrayrefs and hashrefs. But this refers to the serialized +format, not the in-memory structure.) + +YAML ãã¼ãã¨ã¯ç¹å®ã®ãã¼ã¿æ§é ã®è¡¨ç¾ã§ã. ãã¼ãã«ã¯ä»ã®ãã¼ãã +å«ã¾ãã¦ããã§ããã. (Perl ã®ç¨èªã§ããã°, ãã¼ãã¯ã¹ã«ã©ã¼ã® +ãããªç©ã§ã. æåå, é åãªãã¡ã¬ã³ã¹, ããã·ã¥ãªãã¡ã¬ã³ã¹. +ãããããã¯ã¡ã¢ãªå é¨ã®æ§é ã§ã¯ãªãã·ãªã¢ã©ã¤ãºãããå½¢å¼ã +åç §ãã¾ã.) + +=item tag + +ã¿ã° + +This is similar to a type. It indicates how a particular YAML node +serialization should be transferred into or out of memory. For instance +a Foo::Bar object would use the tag 'perl/Foo::Bar': + +ããã¯åã¨ä¼¼ã¦ãã¾ã. ããã¯ç¹å®ã® YAML ãã¼ãç¥ãèããã¼ã·ã§ã³ã +ã¡ã¢ãªã®ä¸ãããã¯å¤ã§ã©ã®ããã«è»¢éãããã¹ããã示ãã¾ã. ä¾ãã° +Foo::Bar ãªãã¸ã§ã¯ãã¯ã¿ã° 'perl/Foo::Bar' ã使ãã¾ã: + + - !perl/Foo::Bar + foo: 42 + bar: stool + +=item collection + +ã³ã¬ã¯ã·ã§ã³ + +A collection is the generic term for a YAML data grouping. YAML has two +types of collections: mappings and sequences. (Similar to hashes and arrays) + +ã³ã¬ã¯ã·ã§ã³ã¨ã¯ YAML ãã¼ã¿ã°ã«ã¼ãã®ç·ç§°ã§ã. YAML ã«ã¯ +ï¼ç¨®é¡ã®ã³ã¬ã¯ã·ã§ã³, ãããã³ã°ã¨ã·ã¼ã±ã³ã¹ãããã¾ã. (ããã·ã¥ã¨ +é åã®ãããªç©ã§ã.) + +=item mapping + +ãããã³ã° + +A mapping is a YAML collection defined by unordered key/value pairs with +unique keys. By default YAML mappings are loaded into Perl hashes. + +ãããã³ã°(åå)ã¨ã¯é åºã®ãªããã¼/å¤ãã¢ã¨ã¦ãã¼ã¯ãªãã¼ã§å®ç¾© +ããã YAML ã³ã¬ã¯ã·ã§ã³ã§ã. ããã©ã«ãã§ã¯ YAML ãããã³ã°ã¯ +Perl ã®ããã·ã¥ã¨ãã¦ãã¼ãããã¾ã. + + a mapping: + foo: bar + two: times two is 4 + +=item sequence + +ã·ã¼ã±ã³ã¹ + +A sequence is a YAML collection defined by an ordered list of elements. By +default YAML sequences are loaded into Perl arrays. + +ã·ã¼ã±ã³ã¹ã¨ã¯è¦ç´ ã®é åºä»ããªã¹ãã¨ãã¦å®ç¾©ããã YAML ã³ã¬ã¯ã·ã§ã³ +ã§ã. ããã©ã«ãã§ã¯ YAML ã·ã¼ã±ã³ã¹ã¯ Perl ã®é åã¨ã㦠+ãã¼ãããã¾ã. + + a sequence: + - one bourbon + - one scotch + - one beer + +=item scalar + +ã¹ã«ã©ã¼ + +A scalar is a YAML node that is a single value. By default YAML scalars +are loaded into Perl scalars. + +ã¹ã«ã©ã¼ã¨ã¯ï¼ã¤ã®å¤ãããªã YAML ãã¼ãã§ã. ããã©ã«ãã§ã¯ YAML +ã¹ã«ã©ã¼ã¯ Perl ã®ã¹ã«ã©ã¼ã¨ãã¦ãã¼ãããã¾ã. + + a scalar key: a scalar value + +YAML has many styles for representing scalars. This is important because +varying data will have varying formatting requirements to retain the +optimum human readability. + +YAML ã«ã¯ã¹ã«ã©ã¼ã表ç¾ããå¹¾ã¤ãã®ã¹ã¿ã¤ã«ãããã¾ã. ãã㯠+æ§ã ãªãã¼ã¿ã¯æé©ãªå¯èªæ§ãå¾ãããã«æ§ã ãªãã£ã¼ããããå¿ è¦ã¨ãã +ããã«ã¨ã¦ãéè¦ãªãã¨ã§ã. + +=item plain scalar + +ãã¬ã¤ã³ã¹ã«ã©ã¼ + +A plain sclar is unquoted. All plain scalars are automatic candidates +for "implicit tagging". This means that their tag may be determined +automatically by examination. The typical uses for this are plain alpha +strings, integers, real numbers, dates, times and currency. + +ãã¬ã¤ã³ã¹ã«ã©ã¼ã¯ã¯ãªã¼ãããã¦ãã¾ãã. +å ¨ã¦ã®ãã¬ã¤ã³ã¹ã«ã©ã¼ã¯"æé»ã«ã¿ã°ä»ã"ãããã¾ã. +ããã¯ãã®ã¿ã°ã¯è©¦é¨ããèªåçã«æ±ºå®ããããã¨ãæå³ãã¾ã. +å ¸åçãªå©ç¨å ´é¢ã¯åãªãæåå, æ´æ°, å®æ°, æ¥ä», +æå», é貨ãããã¾ã. + + - a plain string + - -42 + - 3.1415 + - 12:34 + - 123 this is an error + +=item single quoted scalar + +ã·ã³ã°ã«ã¯ãªã¼ããããã¹ã«ã©ã¼ + +This is similar to Perl's use of single quotes. It means no escaping +except for single quotes which are escaped by using two adjacent +single quotes. + +ãã㯠Perl ã®ã·ã³ã°ã«ã¯ãªã¼ãã®ä½¿ãæ¹ã¨ä¼¼ã¦ãã¾ã. +ï¼ã¤ã®ã·ã³ã°ã«ã¯ãªã¼ãã¯ï¼ã¤ã®é£ç¶ããã·ã³ã°ã«ã¯ãªã¼ãã¨ã㦠+ã¨ã¹ã±ã¼ãããã以å¤ã¯ä½ã®ã¨ã¹ã±ã¼ãããããªããã¨ãæå³ãã¾ã. + + - 'When I say ''\n'' I mean "backslash en"' + +=item double quoted scalar + +ããã«ã¯ãªã¼ããããã¹ã«ã©ã¼ + +This is similar to Perl's use of double quotes. Character escaping can +be used. + +ãã㯠Perl ã®ããã«ã¯ãªã¼ãã®ä½¿ãæ¹ã¨ä¼¼ã¦ãã¾ã. æåã¨ã¹ã±ã¼ãã +使ããã¨ãåºæ¥ã¾ã. + + - "This scalar\nhas two lines, and a bell -->\a" + +=item folded scalar + +ããã¿è¾¼ã¾ããã¹ã«ã©ã¼ + +This is a multiline scalar which begins on the next line. It is +indicated by a single right angle bracket. It is unescaped like the +single quoted scalar. Line folding is also performed. + +ããã¯ãã®æ¬¡ã®è¡ããå§ã¾ãè¤æ°è¡ã®ã¹ã«ã©ã¼ã§ã. +ï¼ã¤ã®å³å±±å½¢æ¬å¼§ã§æ示ããã¾ã. ã·ã³ã°ã«ã¯ãªã¼ãæååã®ããã« +ã¨ã¹ã±ã¼ãã¯ããã¾ãã. è¡ã®ããã¿è¾¼ã¿ãè¡ããã¾ã. + + - > + This is a multiline scalar which begins on + the next line. It is indicated by a single + carat. It is unescaped like the single + quoted scalar. Line folding is also + performed. + +=item block scalar + +ãããã¯ã¹ã«ã©ã¼ + +This final multiline form is akin to Perl's here-document except that +(as in all YAML data) scope is indicated by indentation. Therefore, no +ending marker is required. The data is verbatim. No line folding. + +ãã®æå¾ã®è¤æ°è¡å½¢å¼ã¯ (å ¨ã¦ã® YAML ãã¼ã¿ã®ããã«) ã¹ã³ã¼ãã +ã¤ã³ãã³ãã§æå®ãããç¹ãé¤ã㦠Perl ã®ãã¢ããã¥ã¡ã³ãã¨åæ§ã§ã. + + - | + QTY DESC PRICE TOTAL + --- ---- ----- ----- + 1 Foo Fighters $19.95 $19.95 + 2 Bar Belles $29.95 $59.90 + +=item parser + +ãã¼ãµ + +A YAML processor has four stages: parse, load, dump, emit. + +YAML å¦çç³»ã¯ï¼ã¤ã®ã¹ãã¼ã¸, ãã¼ã¹, ãã¼ã, ãã³ã, çºè¡(emit)ã +æã£ã¦ãã¾ã + +A parser parses a YAML stream. YAML.pm's Load() function contains a +parser. + +ãã¼ãµã¯ YAML ã¹ããªã¼ã ããã¼ã¹ãã¾ã. YAML.pm ã® Load() é¢æ°ã¯ +ãã¼ãµãå«ãã§ãã¾ã. + +=item loader + +ãã¼ã + +The other half of the Load() function is a loader. This takes the +information from the parser and loads it into a Perl data structure. + +Load é¢æ°ã®æ®ãã®ååã¯ãã¼ãã§ã. ããã¯ãã¼ãµããæ å ±ã +åãåã£ã¦ããã Perl ã®ãã¼ã¿æ§é ã«å±éãã¾ã. + +=item dumper + +ãã³ãã¼ + +The Dump() function consists of a dumper and an emitter. The dumper +walks through each Perl data structure and gives info to the emitter. + +Dump() é¢æ°ã¯ãã³ãã¼ã¨ã¨ããã¿ã¼ãæã£ã¦ãã¾ã. ãã³ãã¼ã¯ +ããããã® Perl ãã¼ã¿æ§é ã渡ãæ©ãã¦ãã®æ å ±ãã¨ããã¿ã¼ã« +渡ãã¾ã. + +=item emitter + +ã¨ããã¿ã¼ + +The emitter takes info from the dumper and turns it into a YAML stream. + +ã¨ããã¿ã¼ã¯ãã³ãã¼ãããã¼ã¿ãåãåã£ã¦ããã YAML ã¹ããªã¼ã ã« +å¤æãã¾ã. + +NOTE: +In YAML.pm the parser/loader and the dumper/emitter code are currently +very closely tied together. In the future they may be broken into +separate stages. + +ã¡ã¢: +YAML.pm ã§ã¯ãã¼ãµ/ãã¼ãã¨ãã³ãã¼/ã¨ããã¿ã¼ã®ã³ã¼ãã¯ä»ã®ã¨ãã +ãäºãã¨ã¦ãå¯æ¥ã«çµã³ã¤ãã¦ãã¾ã. ä»å¾ç¬ç«ããã¹ãã¼ã¸ã«å解ããã +ããããã¾ãã. + +=back + +For more information please refer to the immensely helpful YAML +specification available at L<http://www.yaml.org/spec/>. + +ãã詳ããæ å ±ã¯ L<http://www.yaml.org/spec/> ã«ãã巨大ã§å½¹ç«ã¤ +YAML ä»æ§ãåç §ãã¦ãã ãã. + +=head1 ysh - YAML ã·ã§ã« + +The YAML distribution ships with a script called 'ysh', the YAML shell. +ysh provides a simple, interactive way to play with YAML. If you type in +Perl code, it displays the result in YAML. If you type in YAML it turns +it into Perl code. + +YAML é å¸ç©ã«ã¯ 'ysh', YAML ã·ã§ã« ã¨å¼ã°ããã¹ã¯ãªãããå梱ãã㦠+ãã¾ã. ysh 㯠YAML ã§éã¶ç°¡åã§ã¤ã³ã¿ã©ã¯ãã£ããªæ¹æ³ãæä¾ãã¾ã. +Perl ã³ã¼ããæã¡è¾¼ãã°ãã®çµæã YAML ã§è¡¨ç¤ºã, YAML ãå ¥åããã° +Perl ã³ã¼ãã帰ã£ã¦ãã¾ã. + +To run ysh, (assuming you installed it along with YAML.pm) simply type: + +ysh ãå®è¡ãããã«ã¯, (YAML.pm ã¨ä¸ç·ã«ã¤ã³ã¹ãã¼ã«ããã¦ãã㨠+æãã¤ã¤) 次ã®ããã«ã¿ã¤ããã¾ã: + + ysh [options] + +Please read the C<ysh> documentation for the full details. There are +lots of options. + +詳細㯠C<ysh> ããã¥ã¡ã³ãã¼ã·ã§ã³ãåç §ãã¦ãã ãã. +ã¨ã¦ãå¤ãã®ãªãã·ã§ã³ãããã¾ã. + +=head1 ãã°ã¨ä¸è¶³ + +If you find a bug in YAML, please try to recreate it in the YAML Shell +with logging turned on ('ysh -L'). When you have successfully reproduced +the bug, please mail the LOG file to the author (ingy****@cpan*****). + +YAML ã§ãã°ãè¦ã¤ããã¨ãã«ã¯, ãã°ãæå¹ã«ãã YAML ã·ã§ã« ('ysh -L') 㧠+åç¾ããã¦ã¿ã¦ãã ãã. åç¾ã§ããã¨ãã«ã¯ãã®ãã°ãã¡ã¤ã«ãä½è +(ingy****@cpan*****) ã¾ã§ã¡ã¼ã«ããé¡ããã¾ã. + +WARNING: This is still *ALPHA* code. Well, most of this code has been +around for years... + +è¦å: ããã¯ã¾ã *ã¢ã«ãã¡* ã³ã¼ãã§ã. ãã®ã³ã¼ãã®ã»ã¨ãã©ã¯ +ã»ã¼æ°å¹´ã«ããã£ã¦ããã¾ã. + +BIGGER WARNING: YAML.pm has been slow in the making, but I am committed +to having top notch YAML tools in the Perl world. The YAML team is close +to finalizing the YAML 1.1 spec. This version of YAML.pm is based off of +a very old pre 1.0 spec. In actuality there isn't a ton of difference, +and this YAML.pm is still fairly useful. Things will get much better in +the future. + +大ããªè¦å: YAML.pm ã¯çæã¯é ãã§ããç§ã¯æä¸æ®µéã® YAML ãã¼ã«ã +Perl ã®ä¸çã«ã³ããããã¾ãã. YAML ãã¼ã 㯠YAML 1.1 ä»æ§ã®å®äºã« +è¿ã¥ãã¦ãã¾ã. YAML.pm ã®ãã®ãã¼ã¸ã§ã³ã¯ã¨ã¦ãå¤ã pre 1.0 ä»æ§ +ã«åºã¥ãã¦ãã¾ã. ç¾ç¶, 大ããªéãã¯ããã¾ããã, ãã® YAML.pm 㯠+ã¾ã ã¨ã¦ã便å©ã§ã. ä»å¾ãããããªã£ã¦ããã§ããã. + +=head1 åèæç® + +L<http://lists.sourceforge.net/lists/listinfo/yaml-core> is the mailing +list. This is where the language is discussed and designed. + +ã¡ã¼ãªã³ã°ãªã¹ãã L<http://lists.sourceforge.net/lists/listinfo/yaml-core> +ã«ããã¾ã. è¨èªã¯ããã§è°è«ãã, è¨è¨ããã¾ã. + +L<http://www.yaml.org> is the official YAML website. + +å ¬å¼ã® YAML ã¦ã§ããµã¤ã㯠L<http://www.yaml.org> ã§ã. + +L<http://www.yaml.org/spec/> is the YAML 1.0 specification. + +YAML 1.0 ä»æ§ã¯ L<http://www.yaml.org/spec/> ã«ããã¾ã. + +L<http://yaml.kwiki.org> is the official YAML wiki. + +å ¬å¼ã® YAML wiki ã L<http://yaml.kwiki.org> ã«ããã¾ã. + +=head1 é¢é£é ç® + +See YAML::Syck. Fast! + +ã¾ããªãã¨ãã£ã¦ã YAML::Syck ã§ããã. + +=head1 èè + +Ingy dE<ouml>t Net <ingy****@cpan*****> + + +is resonsible for YAML.pm. + +㯠YAML.pm ã resonsible ãã¦ãã¾ã(訳注:resonsibleã¦ä½ï¼^^;) + +The YAML serialization language is the result of years of collaboration +between Oren Ben-Kiki, Clark Evans and Ingy dE<ouml>t Net. Several others +have added help along the way. + +YAML ç´ååè¨èªã¯ Oren Ben-Kiki, Clark Evans, ãã㦠Ingy dE<ouml>t Net +ã®æ°å¹´éã®å ±åä½æ¥ã®çµæ¶ã§ã. ãã以å¤ã«ãããããã«å©ãã¦ããã人ã +ãã¾ã. + +=head1 èä½æ¨© + +Copyright (c) 2005, 2006. Ingy dE<ouml>t Net. All rights reserved. +Copyright (c) 2001, 2002, 2005. Brian Ingerson. All rights reserved. + + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +ãã®ããã°ã©ã ã¯ããªã¼ã½ããã¦ã§ã¢ã§ããããªã㯠Perl ã¨åã +ã©ã¤ã»ã³ã¹ã® å ã§åé å¸åã³å¤æ´ãè¡ããã¨ãåºæ¥ã¾ã. + +See L<http://www.perl.com/perl/misc/Artistic.html> + +åè L<http://www.perl.com/perl/misc/Artistic.html> +