Skip to content

Latest commit

 

History

History
executable file
·
1477 lines (959 loc) · 38.5 KB

YAML.pod

File metadata and controls

executable file
·
1477 lines (959 loc) · 38.5 KB

NAME

YAML - YAML Ain't Markup Language (tm)

SYNOPSIS

use YAML;

# Load a YAML stream of 3 YAML documents into Perl data structures.
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
    - white
    - blue
---
- Clark Evans
- Oren Ben-Kiki
- Brian Ingerson
--- >
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" is catchy and fun to say. Try it. "YAML, YAML, YAML!!!"
...

# Dump the Perl data structures back into YAML.
print Dump($string, $arrayref, $hashref); 

# YAML::Dump is used the same way you'd use Data::Dumper::Dumper
use Data::Dumper;
print Dumper($string, $arrayref, $hashref); 

DESCRIPTION

YAML.pm ��≪�吾�ャ�若�˨�� YAML 1.0 篁�罕� http://www.yaml.org/spec/ ��� ��冴�˨����� YAML ��㏍�若����������潟�����絎�茖������障�����

YAML ��壚査�����˨����c�⓾�勐櫝˛��с�������ï�����������羆������勉����若�睡�翫�����荐�茯���с����� ��祉�������í�勛憘撮��勉����㏍�違�í����潟�域��茯�(Perl �����˨�帥�障��!!!)��勉����若�炊�������� 荐�菴違�������勉�˩戎�����障�����

YAML ��勖��羈���̹�≪����������宴�˨�ゃ����⓾�壔��YAML 篁�罕���������с����☖�����������

WHY YAML IS COOL

YAML is readable for people.

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 is editable.

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 is multilingual.

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 and Java. It was also designed to be interoperable between those languages. That means any YAML serialization produced by Perl can be processed by Python, and be guaranteed to return the data structure intact. (Even if it contained Perl specific structures like GLOBs)

YAML is taint safe.

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 eval() built-in to deserialize the data. Somebody could add a snippet of Perl to erase your files.

YAML's parser does not need to eval anything.

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.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 is extensible.

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 type (or "transfer method") which can cause that node to be interpreted in a completely different manner. That's how YAML can support oddball structures like Perl's typeglob.

YAML.pm plays well with others.

YAML has been designed to interact well with other Perl Modules like POE and Time::Object. (date support coming soon)

USAGE

Exported Functions

YAML.pm ���篁ヤ����勉�������˩戎�����������������í�˨����у��菴違�������∽�違�� �����壔�鴻����若����������障��:

use YAML;

YAML.pm ��������勉����壔�鴻����若�������帥�������˨�壔��篁ヤ����勉�������˨����障��:

use YAML ();
Dump(list-of-Perl-data-structures)

Perl ��勉����若�帥�� YAML ��˨����障����� �����勰�∽�違�� Data::Dumper::Dumper() ��◒��絽吾�̬�壔�鋍若����������������障����� Perl ��勉����若�炊�����篏���勉�ŝ�鴻�����綣���違�������������激�ŝ�≪�í�ゃ�冴��������綵≪�˨����障����� YAML ��鴻����ŝ�若����勖��絖�������菴������障����� 罕����篏���壔�ŝ����<�㋘�潟�鴻�с�����膣���鴻�˨�í�с��罕������障��������

Load(string-containing-a-YAML-stream)

YAML ��� Perl ��勉����若�帥�˨����障�������������� Dump ��勰����с����� ��<�������� Data::Dumper ��˨����������鴻����√櫝�純�� thaw() ��∽�違�� eval() ��∽�違� ��������ŝ����勉�с����� valid ��� YAML ��鴻����ŝ�若����勖��絖������������若�冴�����Perl �����若�炊�����篏���勉�ŝ�鴻����˨����障�����

Store()

�����勰�∽�違�奝���ィ絅���с���憜����� Dump ���篏帥����������˨�ŝ�c�⓾����障����� 罩翫兏����ɾ����宴�˨�������障����ñ���櫝�純�с��������-w ��ŝ����激�с�潟��篏帥�c�⓾������� 茘☗�������阪�������障����������<����������ŝ����� -w ���篏帥�c�⓾�������с�����������? :)

�����勰�∽�違������ィ絅���˨�ŝ�c�������宴�壔��YAML 篁�罕���� Loaders ��� Dumpers �� ��若�違����������㏍�違�í����˨�ゃ����☀����������⓾�������������с����� "Storers" ��虁�������˨�������������◐����壩�������障��...

Exportable Functions

DumpFile(filepath, list)

YAML ��鴻����ŝ�若��������絖������������☀�������勉�с�壔�ŝ����������<�ゃ�˨����吾��莨若�帥�障�����

LoadFile(filepath)

YAML ��鴻����ŝ�若��������絖������������с�壔�ŝ����������<�ゃ�˨�����茯㏍�粋昭��帥�障�����

Bless(perl-node, [yaml-node | class-name])

���絽吾�� Perl �����若����� YAML �����若����̹�∫�d�������障����� YAML �����若����� YAML::Node ��壔�í�鴻�◐����割����������������ŝ����吾�с�壔����с����� 2 ��ɾ�勉�勐����違�壔����≪�˩�����羝���帥�� YAML �����若��������yaml_dump() ��∽�違� 絲上�������⓾�������壔�í��(��������宴�若��)�����勉�í�<�������с����� yaml_dump() ��∽�違�� perl �����若�����綣���違�������c�⓾��YAML �����若����� 菴����綽�荀������������障����� 2 ��ɾ�勉�勐����違��筝������������ŝ����c����翫�����Bless ��∽�違�� YAML �����若�����篏���������障����� �����勉����若����虁����������障�����������Blessed() ��∽�違�у����������������������с����障�����

��������壔�í�勉�������� Bless ���篏帥�������勌����с����� ��������� 3 ��ゃ�勉�㏍�若�������ゃ�������激�ャ����������障�������������勉����� 2 ��ゃ�������������潟����������� ��������障�������������˨�㏍�若�壩浦�����������������ŝ�у�阪�������ŝ�������違�ŝ����ŝ����������障����� 篁ヤ����壔��������茵������号����с��:

use YAML qw(Dump Bless);
$hash = {apple => 'good', banana => 'bad', cauliflower => 'ugly'};
print Dump $hash;
Bless($hash)->keys(['banana', 'apple']);
print Dump $hash;

��������勐�阪����壚札筝���勉����������с�����

--- #YAML:1.0
apple: good
banana: bad
cauliflower: ugly
--- #YAML:1.0
banana: bad
apple: good

Bless ��� YAML �����若����勌�������◐����割�������������������勉��菴������勉�с�� YAML::Node ��<�純����������若�喝�冴�������������с����障����� ��������� YAML::Node::ynode() ���菴���������勉����������с����� 緇���c�⓾��筝�荐���勌��������������������������������筝���ゃ�勖�号����壚札筝���勰�������с��:

use YAML qw(:all);
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;
Blessed(perl-node)

��劫����� perl �����若����◐����割�������������⓾����� YAML �����若�����菴������障�� (筝�荐�������)��������若����� (YAML ���) bless ��������⓾����ŝ����翫���� undef ���菴������障�����

Dumper()

Dump() ��勐�ュ����с�����Data::Dumper �����<�括����с�����

freeze() and thaw()

Dump() ��� Load() ��勐�ュ����с�����Storable �����<�括����с�����

��������˨�������� YAML.pm ��� POE.pm ��勉�������� freeze/thaw API ��� �����◐�翫�������������☎����������≪�吾�ャ�若�˨�◐�贋・�・膓���с�������������˨����ŝ����障�����

Exportable Function Groups

篁ヤ����壔����壔�鴻����若����������∽�違�勉����障����障�ŝ�違�˨�若����勉�ŝ�鴻����с����� 罨<�勉�������ʋ��羈���у�ñ����с����障��:

use YAML ':groupname';
all

Dump(), Load(), Store(), DumpFile(), LoadFile(), Bless(), Blessed() ��� ��ゃ�潟����若�������障�����

POE

freeze() ��� thaw() �����ゃ�潟����若�������障�����

Storable

freeze() ��� thaw() �����ゃ�潟����若�������障�����

Class Methods

YAML ��壔�ŝ����吾�с�壔����������勌��羈���т戎��������������堺�ャ�障����� �����勛�鴻�˨�������⓾��絎������勐�ŭ����с�壔�������障�������� �����勉�ゃ�潟�帥�若����с�若�鴻�壠����ャ�勉�ŝ�ŝ�若�鴻�ф�壕�壔��������篋�絎���с�����

new()

��違����� YAML ��ŝ����吾�с�壔�����菴������障�����箴�:

my $y = YAML->new;
$y->Indent(4);
$y->dump($foo, $bar);

Object Methods

dump()

OO ������ Dump() �����

load()

OO ������ Load() �����

Options

YAML ��ŝ����激�с�潟�� YAML ������腥咲����勉�違�㏍�若�����紊���違��篏帥�c�☀┃絎���������障����� ��������� Data::Dumper ���������������������篏������障�����

箴������違����ゃ�潟����潟��綛����紊���眼����������������壔��篁ヤ����勉�������˨����障��:

local $YAML::Indent = 3;

�憜����勉�ŝ����激�с�潟�壚札筝���勰�������с��:

Indent

Dump() ��������������˨����ゃ�潟����潟����㋘�����罸���˩戎���腥榊�醇��絖���勖�違�с����� ��������í�˨����� 2 ��с�����

�����������с��YAML ��壠����㋘����˨�с�ゃ�潟����潟����������☖�����絖���с��篏帥�������������堺�ャ�障����� 緇���c�⓾��YAML ��������у����眼�������������壠ソ��帥�勤����������˨�ŝ�����������絅純����˨����⓾�������c� 罕������障����������㋘�����罸���̥輝筝���������������⓾�������違�������с�����

UseHeader

��������í�˨����� 1 (���)���

YAML.pm ��� Dump ���篏���勉�������˨�祉����㋘�若�炊��絖�������篏帥�������í�����������絎������障����� ��������壔�鴻����ŝ�若����勖�������勖����吾�˨�勉�翠�ñ����������障����� 綣����膓���������吾�˨�壠��臂í�˨�����綽���� YAML ������������篏帥�������障�����

UseVersion

��������í�˨����� 1 (���)���

YAML.pm �����祉����㋘�若�帥�祉����������� YAML �����若�吾�с�潟����˨����������í�����������絎������障�����

罔�羣������ɱ就��壚札筝���勉����勉�с��:

--- YAML:1.0
SortKeys

��������í�˨����� 1 (���)���

YAML.pm ��������吾��篆�絖���������������˨�������激�ャ�㏍�若�с�純�若�������������í�����������絎������障�����

YAML::Node ��ŝ����吾�с�壔����夌�㋝�ŝ�勉�純�若�������������ゃ����������с����障����� ��������壩�勰�������ŝ����������������勉�с����������� YAML::Node ��勰�����筝���吾�������⓾����˨�������㏍�若����純�若�������������翫����� SortKeys ��� 2 ������絎������障�����

AnchorPrefix

��������í�˨����� ''���

��≪�潟�˨�弱����奝��絽御�医�ゃ�с�����YAML.pm ��壠��膣���� '1' ������紮������⓾�� ��違�������≪�潟�˨�惹�������ゃ��紜���������⓾�������障����� �����勉�ŝ����激�с�潟�壔�������������勉�≪�潟�˨�主�ɱ垩�勐����˩�����������絖����������絎������障�����

UseCode

UseCode ��ŝ����激�с�潟�� DumpCode ��ŝ����激�с�潟�� LoadCode ��ŝ����激�с�潟�� 筝�綺⓾�̬┃絎���������激�с�若����˨�������с����� UseCode ��� '1' ���荐㊤��������������YAML.pm ��� Perl ��潟�若����ŝ����<�㋘�潟�鴻�� (B::Deparse ���篏帥�c��)Perl ��������☗�阪��������茯㏍�粋昭�����������˨� eval() ���篏帥����障����� �����������ŝ����激�с�潟�˨�ŝ�c�⓾����������宴�壔��篆∞����с����ŝ����潟�若����������若�冴�������勉� eval() ���篏帥����勉�壚拭�����ŝ����ŝ����������с����� 絎������ʒ����翫�������� YAML ��勌賢綽������ɾ�勖����勌����ゃ�с�����

DumpCode

YAML.pm ��� Perl ��潟�若����ŝ����<�㋘�潟�鴻����í�勉�������̥�翫�����������������羆阪�������障����� ��������í�˨����с�壔��YAML.pm ��壔�潟�若����ŝ����<�㋘�潟�鴻�勰�������˨�������若����阪�������障�� (Data::Dumper ������罕���с��)���DumpCode ��� '1' ��障����� 'deparse' ���荐㊤�������������� ��潟�若����ŝ����<�㋘�潟�鴻�壠�������� Perl ��勉�潟�若����������⓾����潟�������障�����

DumpCode ��˨�壔�泣����˨�若����潟�吾�勉�ŝ����<�㋘�潟�鴻�����絎���с�������������˨����c� ��㋝�ŝ�勛�翫�������˨�若����潟��篏帥�������������с����障����� YAML.pm ��壔�潟�若����ŝ����<�㋘�潟�鴻����泣����˨�若����潟��羝<����障����� ��泣����˨�若����潟��(���絖�������������)��翫�����������腟������������í�若�����������腓阪����� 菴������障����� �����í�若�����������腓阪����� 'deparse' ��� 'bytecode' ��������c�����膣���ʋ��絖������с�����

LoadCode

LoadCode ��� DumpCode ��勰����с�����YAML ���絲障����⓾�潟�若����ŝ����<�㋘�潟�鴻� �����翫����������í�勉�������̬��������������絎������障����� '1' ��障����� 'deparse' ������絎���������翫�����eval() �����������������障����� 羹���◐����ŝ�ŝ�鴻�壔�����������������篏睡�������� YAML ��勐�堺�������������c�⓾����������勉� 絲障����⓾�勉�推戎��������⓾��������������

LodeCode ��˨�壔�泣����˨�若����潟�吾�勉�ŝ����<�㋘�潟�鴻�����絎���с�������������˨����c� ��㋝�ŝ�勰����翫�������˨�若����潟��篏帥�������������с����障����� YAML.pm ��壩��絖������������⓾�勛�翫����������若�帥�������í�若�����������腓阪�������泣����˨�若����潟� 羝<����障�������泣����˨�若����潟�壔�潟�若����ŝ����<�㋘�潟�鴻��菴������障�����

UseBlock

YAML.pm ��壚�������������������若�����絲障����⓾�í�勉�鴻�˨�í�鴻�帥�ゃ�˨�������壔����� �ィ羝㋘�������������̥�肴��������羈������������障����� �����⓾�勤����域����鴻�˨�í����������㏍����壔����鴻�帥�ゃ�˨��篏帥�c�☗�阪�������������翫����� ��������������������障�������������勉�������ɱ�翫����������勉�ŝ����激�с�潟�� 1 ������絎������障�����

羈����: YAML ��勉����㏍����壔�鴻�帥�ゃ�˨�� Perl ��勉����≪����㏍�ャ�<�潟����◒��篌若����⓾����障�����

ForceBlock

�����㏍����壠就綣���у�阪���櫝�純�ŝ����勉�壠����⓾����㏍����壔�у�阪�������障����� 羈����: �����鴻�宴�若�����絖���壔����㏍����壔�鴻�˨�í�с�壠�阪����с����障��������

UseFold

�����⓾�勤����域����鴻�˨�í�������������潟�帥����鴻�帥�ゃ�˨�т戎�����������翫����� $UseFold ��� 1 ���荐㊤�������障�����

羈����: YAML ��勖�������潟�帥�鴻�帥�ゃ�˨�� HTML ��勖�������潟�帥����㏍�鴻����̹��篌若����⓾����障�������� ������羇�膩眼�������⓾����障�����

UseAliases

YAML ��壔����ゃ�ŝ�≪�号����純�������c�⓾����障�������������壔�<�≪�ŝ�˨����� 罕����篏���壚�������������翫����������������������������勉�с����� �����勖�����篏����絲障����������勌����勉�ŝ����<�㋘�潟�鴻�壔����ゃ�ŝ�≪�鴻����若�˨�若�������⓾�勉� ��翫�������������障�������������˨�����茲�茖純��������������絽亥����ʋ�����篏���� ��翫�������с�������������˨�ŝ����障�����

������������絽違����������������ŝ�������������������c�⓾����������若�帥����� ��������若�����絎������̬��菴違�����綵≪�х�翫�������������������������������������������障����� (�����ŝ����<�ŝ�ŝ�吾����˨�勉�潟����若��������)��� $YAML::UseAliases ��� 0 ��̬┃絎������������������勉�������ŝ����������с�������������˨�ŝ����障����� ��障�����罎�膣≪�ŝ�若����若����������������帥�с�������勉�с����☎�����綺⓾����������ŝ����障�����

�����勉�ŝ����激�с�潟�˨�壠�演�冴����������障����������������若�帥�����絽違����⓾����������� �����勉�ŝ����激�с�潟�˨����� Dump() �����♂����˨�若�����綣����莎激�������� ��<�≪�ŝ��篏帥�������������⓾����障����障�����茘☗�������障�������������㏍��

CompressSeries

��������í�˨����� 1 ���

��������激�ャ�勰�������勉����í�若�������������х軒�����障�����

-
  foo: bar
- 
  bar: foo

��������壚札筝���勉�������˨�ŝ����障��:

- foo: bar
- bar: foo

��勰����壔����勐就綣���勖�鴻�������障�������勉�с�������勉�ŝ����激�с�潟�壔�������í�˨���� 荐㊤����������⓾����障�����

YAML TERMINOLOGY

YAML ��壠�������ʋ����純�������c�������若�睡�翫�����荐�茯���с�������� 緇���c�☎�㋝�ŝ�勐�������◑����������<�障�����

荀������⓾�������鴻����������壔��YAML ��� Perl ��� Python ��勐襲��帥��綣激����������⓾�壔����障�������� ��㋝�ŝ�勤��茯���с�������������ŝ�� Perl 罕����篏���勤;�憝�号����с�壔�ŝ�������������������с�����

YAML ��˨�� 3 腮勰����勖�������������������������� Perl ��勉�������激�ャ����������� ��鴻�˨�í�◒��絽吾�˨����鋍若�⓾����障����� �����������壔����������������������潟�違����激�若�宴�潟�鴻�����絖���������若�違����障����� ��������í�˨����с�壔��篋���渇�������勖����純�������<�障����� ��������������������������勉�ゃ�潟�鴻�帥�潟�鴻�壩��腓榊�������������壩��腓榊����ŝ�帥�ゃ����� �����<����違�ŝ�c����壔�����������荀������障����������勖�号����с�� YAML ��� Perl ��勉�違�㏍����� Python ��勉�帥����˨�� Ruby ��� Bigint ��� 茵◐憗�с����������������≦宍��с����障�����

stream

A YAML stream is the full sequence of bytes 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.

---
a: mapping
foo: bar
---
- a
- sequence
document

A YAML document is an independent data structure representation within a stream. It is a top level node.

--- YAML:1.0
This: top level mapping
is:
    - a
    - YAML
    - document
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.)

transfer method

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 transfer 'perl/Foo::Bar':

- !perl/Foo::Bar
    foo: 42
    bar: stool
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)

mapping

A mapping is a YAML collection defined by key/value pairs. By default YAML mappings are loaded into Perl hashes.

a mapping:
    foo: bar
    two: times two is 4
sequence

A sequence is a YAML collection defined by an ordered list of elements. By default YAML sequences are loaded into Perl arrays.

a sequence:
    - one bourbon
    - one scotch
    - one beer
scalar

A scalar is a YAML node that is a single value. By default YAML scalars are loaded into Perl scalars.

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.

simple scalar

This is a single line of unquoted text. All simple scalars are automatic candidates for "implicit transferring". This means that their type is determined automatically by examination. Unless they match a set of predetermined YAML regex patterns, they will raise a parser exception. The typical uses for this are simple alpha strings, integers, real numbers, dates, times and currency.

- a simple string
- -42
- 3.1415
- 12:34
- 123 this is an error
single quoted scalar

This is similar to Perl's use of single quotes. It means no escaping and no implicit transfer. It must be used on a single line.

- 'When I say ''\n'' I mean "backslash en"'
double quoted scalar

This is similar to Perl's use of double quotes. Character escaping can be used. There is no implicit transfer and it must still be single line.

- "This scalar\nhas two lines, and a bell -->\a"
folded scalar

This is a multiline scalar which begins on the next line. It is indicated by a single closing brace. 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.
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.

- |
    QTY  DESC          PRICE  TOTAL
    ---  ----          -----  -----
      1  Foo Fighters  $19.95 $19.95
      2  Bar Belles    $29.95 $59.90
parser

A YAML processor has four stages: parse, load, dump, emit.

A parser parses a YAML stream. YAML.pm's Load() function contains a parser.

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.

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.

emitter

The emitter takes info from the dumper and turns it into a YAML stream.

NOTE: In YAML.pm the parser/loader and the dumper/emitter code are currently very closely tied together. When libyaml is written (in C) there will be a definite separation. libyaml will contain a parser and emitter, and YAML.pm (and YAML.py etc) will supply the loader and dumper.

For more information please refer to the immensely helpful YAML specification available at http://www.yaml.org/spec/.

ysh - The YAML Shell

YAML ���篁���������宴�若�吾�˨�� 'ysh'(YAML shell' �����若�違�������鴻�壔�ŝ����������ャ�c�⓾����障����� ysh ��壠��膣���у嚳荅援����� YAML ������篏����������罧泣�����箴������障����� Perl ��勉�潟�若�������ュ����������☖��������������YAML ��������☎��������茵◐ず�����障����� YAML �����ュ��������������Perl ��勉�潟�若�����茵◐ず�����障�����

ysh ���絎�茵���������������˨�壔��(YAML.pm �����宴�˨�ゃ�潟�鴻����若�˨�������⓾��������篁勐��������) �����˩札筝���勉�������˨����障��:

ysh [options]

絎������ʃ¼膣違�˨�ゃ����⓾�� ysh ���荀���⓾��������������紊������勉�ŝ����激�с�潟����������障�����

BUGS & DEFICIENCIES

YAML ��勉����違����肴����������������㏍�遺��絖���ŝ����激�с�潟����ゃ����� YAML Shell ('ysh -L') ��у���憗�������⓾�帥�⓾�������������� �����違�勐���憗��������������������LOG �����<�ゃ�˨��篏���� (ingy@cpan.org) �� ��<�若�˨����⓾��������������

茘☗��: ��������壔����≪�˨����<����潟�若����с�����

紊ц⑥���: ��������� YAML 1.0 篁�罕���勉��TRIAL1�����с����� YAML ���羈���夌∈絎�������������紊���眼���������櫝�醇�с����������障����� ����サ��勛��薑�������荐���������������������鎀���眼�������障����� �����勌��罕���勌����������� YAML 1.0 ��勉�������� 1 綛岩札筝�篏�罐㏍����⓾����障�������� 罕������勰�㏍�т��罕������祉�������ð����宴�蚊�c�����菴������⓾����障����� 腱������奝��絽吾�̥Щ���羂���с�����������������絽吾�˨�� �����������������с����������虁�ɱ����ʃ昆��勉�ŝ�鴻�壔�˨�������☖戎��c�⓾�����������!!!

Circular Leaves

YAML ��壠妾��違�������ŝ����<�㋘�潟�鴻����翫����������������������с����障����� ��������⓾�祉�������í�勐�翫��罩c����������翫�������с����障����� 羈���������鴻��筝���ゃ�勌��紊���虁�ɱ����ʃ昆�����˨����������若����吾�勉�ŝ����<�㋘�潟�鴻�с����� ��������� pure Perl ��с�壔����㋘�㋘�潟����̬�������勉�奝�c�������勉�с����� �����後�������ŝ��箴���壚札筝���勉����勉�с��:

$foo = \$foo;

��������勛�翫�������壔����障����������障����������������障��罩c����������若�冴�с����障�������� 罧�綽泣�ŝ��������筝����筝㏍�勤晦�����ŝ�������㏍�違�í�������夌�翫�������≪�吾�ャ�若�˨�� �����鴻�������������������������˨��������荅⓾����������с����� �����������ŝ�������������壔�祉�������í�勐�翫���憜����勌�������˨�壔�ŝ����ゃ�с����� ��������ŝ�������с�������勐�馹����茹f浦������ pure Perl ��勉�����������篏���c����勉� ��ŝ�������������í����������勉����違�壠�怨�������ŝ����с��������������

�����������с��篌若�⓾�壔����⓾�������с�壔�ŝ��罕������� Dump ��� Load ��壔����障����������障��:

$foo->[0] = $foo;

�����������勌����� 'ysh -r' ���篏帥�c�⓾����鴻����с����障����� �����勉�ŝ����激�с�潟�壔��箴������翫�����������緇���̹����翫�������с��������������腆肴�������障����� ��������������壔�����������緇�緇�("roundtripping")�����◑˛�����с�������勉�с�� '-r'��˨�ŝ�c�⓾����障�����

Unicode

Unicode ��壔�障��絲上�������⓾����障�������� YAML 篁�罕���壠����⓾�勖��絖������� Unicode ��с�������������⓾����障�������� �����勐�����絎�茖���壠����� ASCII ���篏帥�c�⓾����障�����

Structured Keys

Python ��� Java (篁���˨����������с��������) ��壔�������激�ャ�勉�㏍�若� ��í����ŝ����若�水����с��篏帥����障�����YAML ������������絲上�������⓾����障����� Perl5 ��壔�������激�ャ�㏍�若�������〠��絖�������������篏帥����障�����

YAML.pm ��夌憜����勉��������罕���������㏍�若�������若�冴�с����障�������� �����勖����潟�� Perl ��������激�ャ�̬˛��粋昭��障�����������紊宴�������障����� 篁ヤ����勌����� YAML Shell ��ц©�����⓾�帥�⓾�����������:

ysh > ---
yaml> ?
yaml>  foo: bar
yaml> : baz
yaml> ...
$VAR1 = {
          'HASH(0x1f1d20)' => 'baz'
        };
ysh >

YAML.pm ��壔�ŝ�������������⓾����������勐�ゃ��篆�絖���������������˩信罩c�����綽�荀������������障����� ��ŝ�������c��? Yaml.pm ��� YAML.py ��т����c�� YAML �����吾����宴�c����������� Python �����若�帥����≦�激�ц�������ŝ�������違�ŝ����ŝ����������с�����

Globs, Subroutines, Regexes and File Handles

腱���勛�ャ�����������篁���� Perl ��翫�������≪�吾�ャ�若�˨�壔�� �����違�㏍�������泣����˨�若�����(��潟�若����ŝ����<�㋘�潟��)���罩h�頫◐憗�� �����<�ゃ�˨����潟����˨�勛�翫�������������翫�������壔�с����障�������� YAML.pm ��壔�������������⓾�������潟����������遵�������������障����� ������������茯㏍�粋昭�����������������ŝ�������˨�ŝ����������������障��������羈���������⓾��������������

羈����: Perl ��勉�違�㏍�若����˨�ŝ��������������(綏�紊с��)�����潟�����篏������˨�壔�� 篁ヤ����勉�������˨����⓾�����������:

perl -MYAML -e '$YAML::UseCode=1; print Dump \%main::'

1 ��ゃ�勐�����腥咲�������狗����������ŝ�����篁ヤ����勉�������˨����⓾�����������:

perl -MCGI -MYAML -e '$YAML::UseCode=1; print Dump \%CGI::'
Speed

��������壠�☎�����綺⓾�с�壔�ŝ����������㏍�違�í����勐櫝˛��с�������ï����������������˨�� pure Perl ��у��茖���������⓾����障�����

Neil Watkiss and Clark Evans are currently developing libyaml, the official C implementation of the YAML parser and emitter. YAML.pm will be refactoring to use this library once it is stable. Other languages like Python, Tcl, PHP, Ruby, JavaScript and Java can make use of the same core library.

Please join us on the YAML mailing list if you are interested in implementing something.

https://lists.sourceforge.net/lists/listinfo/yaml-core

Streaming Access

�����勉�≪�吾�ャ�若�˨�� Dump ��� Load ��壠��筝���勖��篏���˨�ŝ�c�⓾����障����� YAML ��鴻����ŝ�若����� 1 �����若�������ゃ����若�鴻����������������������ゃ�潟�帥�若����с�若�鴻� ��������障��������"all or nothing"��с�����

絨���ャ�勉�ŝ�ŝ�若�鴻�с�奝��罨∞�������若�冴��絲上��������篋�絎���с����� ���罨∞�������潟����壔�������育�c�с����������違��������緇���<��������������

RESOURCES

��眼�ŝ�� YAML ��勖����純�̹�≪����⓾�� YAML::Node ���荀���⓾��������������

http://www.yaml.org ��� YAML ��㋚����⓾�с����泣�ゃ����с�����

http://www.yaml.org/spec/ ��� YAML 1.0 篁�罕���吾�с�����

http://wiki.yaml.org/spec/ ��� YAML ��㋚�� wiki ��с�����

YAML ��� SourceForge �����㏍�吾�с�壔����������☎�脂�蚊�������⓾����障�� (http://www.sourceforge.net)��� �憜����勉�������������<�若�ŝ�潟�違�ŝ�鴻��罘���純�勉�帥����ñ�������⓾����障�����

IMPLEMENTATIONS

��������� YAML 1.0 篁�罕������冴�˨�����罘���純�勖�������勐��茖���с�����

篁ヤ����勌査������絎�茖���̬����潟��腓冴����⓾����障����� 絎�茖������吾����������̬����潟����������ŝ�����綵若����̹�g機�����⓾�帥�⓾��������������

---
- name:    Neil Watkiss
  project: 
    - libyaml
    - YAML mode for the vim editor
  email:   nwatkiss@ttul.org

- name:    Brian Ingerson
  project: YAML.pm, libyaml Perl binding
  email:   ingy@ttul.org

- name:    Clark Evans
  project: libyaml, Python binding
  email:   cce@clarkevans.com

- name:    Oren Ben-Kiki
  project: Java Loader/Dumper
  email:   orenbk@richfx.com

- name:    Paul Prescod
  project: YAML Antagonist/Anarchist
  email:   paul@prescod.net

- name:    Ryan King
  project: YAML test specialist
  email:   rking@panoptic.com

- name:    Steve Howell
  project: Python and Ruby implementations
  email:   showell@zipcon.net

- name:    Patrick Leboutillier
  project: Java Loader/Dumper
  email:   patrick_leboutillier@hotmail.com

- name:    Shane Caraveo
  project: PHP Loader/Dumper
  email:   shanec@activestate.com

- name:    Brian Quinlan
  project: Python Loader/Dumper
  email:   brian@sweetapp.com

- name:    Jeff Hobbs
  project: Tcl Loader/Dumper
  email:   jeff@hobbs.org

- name:    Claes Jacobsson
  project: JavaScript Loader/Dumper
  email:   claes@contiller.se

AUTHOR

Brian Ingerson <INGY@cpan.org> is resonsible for YAML.pm.

The YAML language is the result of a ton of collaboration between Oren Ben-Kiki, Clark Evans and Brian Ingerson. Several others have added help along the way.

Neil Watkiss is pioneering libyaml. Bless that boy!

Ryan King offered much help on the 0.35 release. The XP advocate extraordinaire, help me refactor my entire test suite into its current form. Regression tests are extremely important to the success of this project.

COPYRIGHT

Copyright (c) 2001, 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 http://www.perl.com/perl/misc/Artistic.html