=encoding euc-jp =head1 NAME =begin original YAML::Node - A generic data node that encapsulates YAML information =end original YAML::Node - YAML 情報をカプセル化する汎用データノード =head1 SYNOPSIS use YAML; use YAML::Node; my $ynode = YAML::Node->new({}, 'ingerson.com/fruit'); %$ynode = qw(orange orange apple red grape green); print Dump $ynode; =begin original yields: =end original とすると: --- #YAML:1.0 !ingerson.com/fruit orange: orange apple: red grape: green =head1 DESCRIPTION =begin original A generic node in YAML is similar to a plain hash, array, or scalar node in Perl except that it must also keep track of its type. The type is a URI called the YAML type family. =end original YAML の汎用ノードは Perl での普通のハッシュ、配列、スカラノードと 似ていますが、型を保存しているところが違います。 この型は YAML 型ファミリと呼ばれる URI です。 =begin original YAML::Node is a class for generating and manipulating these containers. A YAML node (or ynode) is a tied hash, array or scalar. In most ways it behaves just like the plain thing. But you can assign and retrieve and YAML type family URI to it. For the hash flavor, you can also assign the order that the keys will be retrieved in. By default a ynode will offer its keys in the same order that they were assigned. =end original YAML::Node はこれらのコンテナを生成、操作するためのクラスです。 YAML ノード(ynode)はハッシュ、配列、スカラのいずれかと結び付けられます。 ほとんどの場合これは普通のものと同じように振る舞います。 しかし、YAML 型ファミリ URI を割り当てたり所得したりできます。 ハッシュ用には、キーを取り出す順番を割り当てることもできます。 デフォルトでは ynode は割り当てられたのと同じ順番で提供されます。 =begin original YAML::Node has a class method call new() that will return a ynode. You pass it a regular node and an optional type family. After that you can use it like a normal Perl node, but when you YAML::Dump it, the magical properties will be honored. =end original YAML::Node は ynode を返す new() クラスメソッド呼び出しを持ちます。 引数として通常のノードと、オプションの型ファミリを渡します。 その後、これを通常の Perl ノードとどう夜につかうことができますが、 YAML::Dump を使ったときに、秘密のプロパティが効力をもちます。 =begin original This is how you can control the sort order of hash keys during a YAML serialization. By default, YAML sorts keys alphabetically. But notice in the above example that the keys were Dumped in the same order they were assigned. =end original これが YAML 直列化でハッシュキーのソート順を制御する方法です。 デフォルトでは、YAML はキーをアルファベット順にソートします。 しかし、上記の例では、割り当てられたのと同じ順番で Dump されています。 =begin original YAML::Node exports a function called ynode(). This function returns the tied object so that you can call special methods on it like ->keys(). =end original YAML::Node は ynode() 関数をエクスポートします。 この関数は結び付けられたオブジェクトを返すので、 返り値に対して ->keys() のような特別なメソッドを呼び出せます。 =begin original keys() works like this: =end original keys() は以下のように動作します: use YAML; use YAML::Node; %$node = qw(orange orange apple red grape green); $ynode = YAML::Node->new($node); ynode($ynode)->keys(['grape', 'apple']); print Dump $ynode; =begin original produces: =end original 出力は以下のようになります: --- #YAML:1.0 grape: green apple: red =begin original It tells the ynode which keys and what order to use. =end original これにより、ynode が どのキーをどのような順番で使うのかがわかります。 =begin original ynodes will play a very important role in how programs use YAML. They are the foundation of how a Perl class can marshall the Loading and Dumping of its objects. =end original ynode は プログラムがどのように YAML を使うかにおいて重要な 役割を演じます。これはオブジェクトを Load したり Dump したりするときに Perl クラスがどのように整列させるかの基礎となります。 =begin original The upcoming versions of YAML.pm will have much more information on this. =end original YAML.pm の将来のバージョンではより多くの情報を持つ予定です。 =head1 AUTHOR Brian Ingerson =head1 COPYRIGHT Copyright (c) 2002. 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. See L