1YAML::PP(3)           User Contributed Perl Documentation          YAML::PP(3)
2
3
4

NAME

6       YAML::PP - YAML 1.2 processor
7

SYNOPSIS

9       WARNING: Most of the inner API is not stable yet.
10
11       Here are a few examples of the basic load and dump methods:
12
13           use YAML::PP;
14           my $ypp = YAML::PP->new;
15
16           my $yaml = <<'EOM';
17           --- # Document one is a mapping
18           name: Tina
19           age: 29
20           favourite language: Perl
21
22           --- # Document two is a sequence
23           - plain string
24           - 'in single quotes'
25           - "in double quotes we have escapes! like \t and \n"
26           - | # a literal block scalar
27             line1
28             line2
29           - > # a folded block scalar
30             this is all one
31             single line because the
32             linebreaks will be folded
33           EOM
34
35           my @documents = $ypp->load_string($yaml);
36           my @documents = $ypp->load_file($filename);
37
38           my $yaml = $ypp->dump_string($data1, $data2);
39           $ypp->dump_file($filename, $data1, $data2);
40
41           # The loader offers JSON::PP::Boolean, boolean.pm or
42           # perl 1/'' (currently default) for booleans
43           my $ypp = YAML::PP->new(boolean => 'JSON::PP');
44           my $ypp = YAML::PP->new(boolean => 'boolean');
45           my $ypp = YAML::PP->new(boolean => 'perl');
46
47           # Enable perl data types and objects
48           my $ypp = YAML::PP->new(schema => [qw/ + Perl /]);
49           my $yaml = $yp->dump_string($data_with_perl_objects);
50
51           # Legacy interface
52           use YAML::PP qw/ Load Dump LoadFile DumpFile /;
53           my @documents = Load($yaml);
54           my @documents = LoadFile($filename);
55           my @documents = LoadFile($filehandle);
56           my $yaml = = Dump(@documents);
57           DumpFile($filename, @documents);
58           DumpFile($filenhandle @documents);
59
60       Some utility scripts, mostly useful for debugging:
61
62           # Load YAML into a data structure and dump with Data::Dumper
63           yamlpp-load < file.yaml
64
65           # Load and Dump
66           yamlpp-load-dump < file.yaml
67
68           # Print the events from the parser in yaml-test-suite format
69           yamlpp-events < file.yaml
70
71           # Parse and emit events directly without loading
72           yamlpp-parse-emit < file.yaml
73
74           # Create ANSI colored YAML. Can also be useful for invalid YAML, showing
75           # you the exact location of the error
76           yamlpp-highlight < file.yaml
77

DESCRIPTION

79       YAML::PP is a modular YAML processor.
80
81       It aims to support "YAML 1.2" and "YAML 1.1". See <https://yaml.org/>.
82       Some (rare) syntax elements are not yet supported and documented below.
83
84       YAML is a serialization language. The YAML input is called "YAML
85       Stream".  A stream consists of one or more "Documents", separated by a
86       line with a document start marker "---". A document optionally ends
87       with the document end marker "...".
88
89       This allows one to process continuous streams additionally to a fixed
90       input file or string.
91
92       The YAML::PP frontend will currently load all documents, and return
93       only the first if called with scalar context.
94
95       The YAML backend is implemented in a modular way that allows one to add
96       custom handling of YAML tags, perl objects and data types. The inner
97       API is not yet stable. Suggestions welcome.
98
99       You can check out all current parse and load results from the yaml-
100       test-suite here:
101       <https://perlpunk.github.io/YAML-PP-p5/test-suite.html>
102

METHODS

104   new
105           my $ypp = YAML::PP->new;
106           # load booleans via boolean.pm
107           my $ypp = YAML::PP->new( boolean => 'boolean' );
108           # load booleans via JSON::PP::true/false
109           my $ypp = YAML::PP->new( boolean => 'JSON::PP' );
110
111           # use YAML 1.2 Failsafe Schema
112           my $ypp = YAML::PP->new( schema => ['Failsafe'] );
113           # use YAML 1.2 JSON Schema
114           my $ypp = YAML::PP->new( schema => ['JSON'] );
115           # use YAML 1.2 Core Schema
116           my $ypp = YAML::PP->new( schema => ['Core'] );
117
118           # Die when detecting cyclic references
119           my $ypp = YAML::PP->new( cyclic_refs => 'fatal' );
120
121           my $ypp = YAML::PP->new(
122               boolean => 'JSON::PP',
123               schema => ['Core'],
124               cyclic_refs => 'fatal',
125               indent => 4,
126               header => 1,
127               footer => 1,
128               version_directive => 1,
129           );
130
131       Options:
132
133       boolean
134           Values: "perl" (currently default), "JSON::PP", "boolean",
135           "perl_experimental"
136
137           This option is for loading and dumping.
138
139           You can also specify more than one class, comma separated.  This is
140           important for dumping.
141
142           Examples:
143
144               boolean => 'JSON::PP,boolean'
145               Booleans will be loaded as JSON::PP::Booleans, but when dumping, also
146               'boolean' objects will be recognized
147
148               boolean => 'JSON::PP,*'
149               Booleans will be loaded as JSON::PP::Booleans, but when dumping, all
150               currently supported boolean classes will be recognized
151
152               boolean => '*'
153               Booleans will be loaded as perl booleans, but when dumping, all
154               currently supported boolean classes will be recognized
155
156           If you have perl >= 5.36 then you might want to try out the
157           experimental boolean support, see builtin.
158
159           YAML::PP supports that by using the "perl_experimental" value for
160           the boolean option. Rules are the same as for the experimental
161           builtin class: It's not guaranteed to work in the future.
162
163           As soon as the builtin boolean support leaves experimental status,
164           I will update YAML::PP to support this via the default "perl"
165           value.
166
167               boolean => 'perl_experimental'
168               Booleans will be loaded as perl booleans, and they will be recognized
169               as such when dumping also
170
171       schema
172           Default: "['Core']"
173
174           This option is for loading and dumping.
175
176           Array reference. Here you can define what schema to use.  Supported
177           standard Schemas are: "Failsafe", "JSON", "Core", "YAML1_1".
178
179           To get an overview how the different Schemas behave, see
180           <https://perlpunk.github.io/YAML-PP-p5/schemas.html>
181
182           Additionally you can add further schemas, for example "Merge".
183
184       cyclic_refs
185           Default: 'allow' but will be switched to fatal in the future for
186           safety!
187
188           This option is for loading only.
189
190           Defines what to do when a cyclic reference is detected when
191           loading.
192
193               # fatal  - die
194               # warn   - Just warn about them and replace with undef
195               # ignore - replace with undef
196               # allow  - Default
197
198       duplicate_keys
199           Default: 0
200
201           Since version 0.027
202
203           This option is for loading.
204
205           The YAML Spec says duplicate mapping keys should be forbidden.
206
207           When set to true, duplicate keys in mappings are allowed (and will
208           overwrite the previous key).
209
210           When set to false, duplicate keys will result in an error when
211           loading.
212
213           This is especially useful when you have a longer mapping and don't
214           see the duplicate key in your editor:
215
216               ---
217               a: 1
218               b: 2
219               # .............
220               a: 23 # error
221
222       indent
223           Default: 2
224
225           This option is for dumping.
226
227           Use that many spaces for indenting
228
229       width
230           Since version 0.025
231
232           Default: 80
233
234           This option is for dumping.
235
236           Maximum columns when dumping.
237
238           This is only respected when dumping flow collections right now.
239
240           in the future it will be used also for wrapping long strings.
241
242       header
243           Default: 1
244
245           This option is for dumping.
246
247           Print document header "---"
248
249       footer
250           Default: 0
251
252           This option is for dumping.
253
254           Print document footer "..."
255
256       yaml_version
257           Since version 0.020
258
259           This option is for loading and dumping.
260
261           Default: 1.2
262
263           Note that in this case, a directive "%YAML 1.1" will basically be
264           ignored and everything loaded with the "1.2 Core" Schema.
265
266           If you want to support both YAML 1.1 and 1.2, you have to specify
267           that, and the schema ("Core" or "YAML1_1") will be chosen
268           automatically.
269
270               my $yp = YAML::PP->new(
271                   yaml_version => ['1.2', '1.1'],
272               );
273
274           This is the same as
275
276               my $yp = YAML::PP->new(
277                   schema => ['+'],
278                   yaml_version => ['1.2', '1.1'],
279               );
280
281           because the "+" stands for the default schema per version.
282
283           When loading, and there is no %YAML directive, 1.2 will be
284           considered as default, and the "Core" schema will be used.
285
286           If there is a "%YAML 1.1" directive, the "YAML1_1" schema will be
287           used.
288
289           Of course, you can also make 1.1 the default:
290
291               my $yp = YAML::PP->new(
292                   yaml_version => ['1.1', '1.2'],
293               );
294
295           You can also specify 1.1 only:
296
297               my $yp = YAML::PP->new(
298                   yaml_version => ['1.1'],
299               );
300
301           In this case also documents with "%YAML 1.2" will be loaded with
302           the "YAML1_1" schema.
303
304       version_directive
305           Since version 0.020
306
307           This option is for dumping.
308
309           Default: 0
310
311           Print Version Directive "%YAML 1.2" (or "%YAML 1.1") on top of each
312           YAML document. It will use the first version specified in the
313           "yaml_version" option.
314
315       preserve
316           Since version 0.021
317
318           Default: false
319
320           This option is for loading and dumping.
321
322           Preserving scalar styles is still experimental.
323
324               use YAML::PP::Common qw/ :PRESERVE /;
325
326               # Preserve the order of hash keys
327               my $yp = YAML::PP->new( preserve => PRESERVE_ORDER );
328
329               # Preserve the quoting style of scalars
330               my $yp = YAML::PP->new( preserve => PRESERVE_SCALAR_STYLE );
331
332               # Preserve block/flow style (since 0.024)
333               my $yp = YAML::PP->new( preserve => PRESERVE_FLOW_STYLE );
334
335               # Preserve alias names (since 0.027)
336               my $yp = YAML::PP->new( preserve => PRESERVE_ALIAS );
337
338               # Combine, e.g. preserve order and scalar style
339               my $yp = YAML::PP->new( preserve => PRESERVE_ORDER | PRESERVE_SCALAR_STYLE );
340
341           Do NOT rely on the internal implementation of it.
342
343           If you load the following input:
344
345               ---
346               z: 1
347               a: 2
348               ---
349               - plain
350               - 'single'
351               - "double"
352               - |
353                 literal
354               - >
355                 folded
356               ---
357               block mapping: &alias
358                 flow sequence: [a, b]
359               same mapping: *alias
360               flow mapping: {a: b}
361
362           with this code:
363
364               my $yp = YAML::PP->new(
365                   preserve => PRESERVE_ORDER | PRESERVE_SCALAR_STYLE
366                               | PRESERVE_FLOW_STYLE | PRESERVE_ALIAS
367               );
368               my ($hash, $styles, $flow) = $yp->load_file($file);
369               $yp->dump_file($hash, $styles, $flow);
370
371           Then dumping it will return the same output.
372
373           Note that YAML allows repeated definition of anchors. They cannot
374           be preserved with YAML::PP right now. Example:
375
376               ---
377               - &seq [a]
378               - *seq
379               - &seq [b]
380               - *seq
381
382           Because the data could be shuffled before dumping again, the anchor
383           definition could be broken. In this case repeated anchor names will
384           be discarded when loading and dumped with numeric anchors like
385           usual.
386
387           Implementation:
388
389           When loading, hashes will be tied to an internal class
390           ("YAML::PP::Preserve::Hash") that keeps the key order.
391
392           Scalars will be returned as objects of an internal class
393           ("YAML::PP::Preserve::Scalar") with overloading. If you assign to
394           such a scalar, the object will be replaced by a simple scalar.
395
396               # assignment, style gets lost
397               $styles->[1] .= ' append';
398
399           You can also pass 1 as a value. In this case all preserving options
400           will be enabled, also if there are new options added in the future.
401
402           There are also methods to create preserved nodes from scratch. See
403           the "preserved_(scalar|mapping|sequence)" "METHODS" below.
404
405   load_string
406           my $doc = $ypp->load_string("foo: bar");
407           my @docs = $ypp->load_string("foo: bar\n---\n- a");
408
409       Input should be Unicode characters.
410
411       So if you read from a file, you should decode it, for example with
412       "Encode::decode()".
413
414       Note that in scalar context, "load_string" and "load_file" return the
415       first document (like YAML::Syck), while YAML and YAML::XS return the
416       last.
417
418   load_file
419           my $doc = $ypp->load_file("file.yaml");
420           my @docs = $ypp->load_file("file.yaml");
421
422       Strings will be loaded as unicode characters.
423
424   dump_string
425           my $yaml = $ypp->dump_string($doc);
426           my $yaml = $ypp->dump_string($doc1, $doc2);
427           my $yaml = $ypp->dump_string(@docs);
428
429       Input strings should be Unicode characters.
430
431       Output will return Unicode characters.
432
433       So if you want to write that to a file (or pass to YAML::XS, for
434       example), you typically encode it via "Encode::encode()".
435
436   dump_file
437           $ypp->dump_file("file.yaml", $doc);
438           $ypp->dump_file("file.yaml", $doc1, $doc2);
439           $ypp->dump_file("file.yaml", @docs);
440
441       Input data should be Unicode characters.
442
443   dump
444       This will dump to a predefined writer. By default it will just use the
445       YAML::PP::Writer and output a string.
446
447           my $writer = MyWriter->new(\my $output);
448           my $yp = YAML::PP->new(
449               writer => $writer,
450           );
451           $yp->dump($data);
452
453   preserved_scalar
454       Since version 0.024
455
456       Experimental. Please report bugs or let me know this is useful and
457       works.
458
459       You can define a certain scalar style when dumping data.  Figuring out
460       the best style is a hard task and practically impossible to get it
461       right for all cases. It's also a matter of taste.
462
463           use YAML::PP::Common qw/ PRESERVE_SCALAR_STYLE YAML_LITERAL_SCALAR_STYLE /;
464           my $yp = YAML::PP->new(
465               preserve => PRESERVE_SCALAR_STYLE,
466           );
467           # a single linebreak would normally be dumped with double quotes: "\n"
468           my $scalar = $yp->preserved_scalar("\n", style => YAML_LITERAL_SCALAR_STYLE );
469
470           my $data = { literal => $scalar };
471           my $dump = $yp->dump_string($data);
472           # output
473           ---
474           literal: |+
475
476           ...
477
478   preserved_mapping, preserved_sequence
479       Since version 0.024
480
481       Experimental. Please report bugs or let me know this is useful and
482       works.
483
484       With this you can define which nodes are dumped with the more compact
485       flow style instead of block style.
486
487       If you add "PRESERVE_ORDER" to the "preserve" option, it will also keep
488       the order of the keys in a hash.
489
490           use YAML::PP::Common qw/
491               PRESERVE_ORDER PRESERVE_FLOW_STYLE
492               YAML_FLOW_MAPPING_STYLE YAML_FLOW_SEQUENCE_STYLE
493           /;
494           my $yp = YAML::PP->new(
495               preserve => PRESERVE_FLOW_STYLE | PRESERVE_ORDER
496           );
497
498           my $hash = $yp->preserved_mapping({}, style => YAML_FLOW_MAPPING_STYLE);
499           # Add values after initialization to preserve order
500           %$hash = (z => 1, a => 2, y => 3, b => 4);
501
502           my $array = $yp->preserved_sequence([23, 24], style => YAML_FLOW_SEQUENCE_STYLE);
503
504           my $data = $yp->preserved_mapping({});
505           %$data = ( map => $hash, seq => $array );
506
507           my $dump = $yp->dump_string($data);
508           # output
509           ---
510           map: {z: 1, a: 2, y: 3, b: 4}
511           seq: [23, 24]
512
513   loader
514       Returns or sets the loader object, by default YAML::PP::Loader
515
516   dumper
517       Returns or sets the dumper object, by default YAML::PP::Dumper
518
519   schema
520       Returns or sets the schema object
521
522   default_schema
523       Creates and returns the default schema
524

FUNCTIONS

526       The functions "Load", "LoadFile", "Dump" and "DumpFile" are provided as
527       a drop-in replacement for other existing YAML processors.  No function
528       is exported by default.
529
530       Note that in scalar context, "Load" and "LoadFile" return the first
531       document (like YAML::Syck), while YAML and YAML::XS return the last.
532
533       Load
534               use YAML::PP qw/ Load /;
535               my $doc = Load($yaml);
536               my @docs = Load($yaml);
537
538           Works like "load_string".
539
540       LoadFile
541               use YAML::PP qw/ LoadFile /;
542               my $doc = LoadFile($file);
543               my @docs = LoadFile($file);
544               my @docs = LoadFile($filehandle);
545
546           Works like "load_file".
547
548       Dump
549               use YAML::PP qw/ Dump /;
550               my $yaml = Dump($doc);
551               my $yaml = Dump(@docs);
552
553           Works like "dump_string".
554
555       DumpFile
556               use YAML::PP qw/ DumpFile /;
557               DumpFile($file, $doc);
558               DumpFile($file, @docs);
559               DumpFile($filehandle, @docs);
560
561           Works like "dump_file".
562

PLUGINS

564       You can alter the behaviour of YAML::PP by using the following schema
565       classes:
566
567       YAML::PP::Schema::Failsafe
568           One of the three YAML 1.2 official schemas
569
570       YAML::PP::Schema::JSON
571           One of the three YAML 1.2 official schemas.
572
573       YAML::PP::Schema::Core
574           One of the three YAML 1.2 official schemas. Default
575
576       YAML::PP::Schema::YAML1_1
577           Schema implementing the most common YAML 1.1 types
578
579       YAML::PP::Schema::Perl
580           Serializing Perl objects and types
581
582       YAML::PP::Schema::Binary
583           Serializing binary data
584
585       YAML::PP::Schema::Tie::IxHash
586           Deprecated. See option "preserve"
587
588       YAML::PP::Schema::Merge
589           YAML 1.1 merge keys for mappings
590
591       YAML::PP::Schema::Include
592           Include other YAML files via "!include" tags
593
594       To make the parsing process faster, you can plugin the libyaml parser
595       with YAML::PP::LibYAML.
596

IMPLEMENTATION

598       The process of loading and dumping is split into the following steps:
599
600           Load:
601
602           YAML Stream        Tokens        Event List        Data Structure
603                     --------->    --------->        --------->
604                       lex           parse           construct
605
606
607           Dump:
608
609           Data Structure       Event List        YAML Stream
610                       --------->        --------->
611                       represent           emit
612
613       You can dump basic perl types like hashes, arrays, scalars (strings,
614       numbers).  For dumping blessed objects and things like coderefs have a
615       look at YAML::PP::Perl/YAML::PP::Schema::Perl.
616
617       YAML::PP::Lexer
618           The Lexer is reading the YAML stream into tokens. This makes it
619           possible to generate syntax highlighted YAML output.
620
621           Note that the API to retrieve the tokens will change.
622
623       YAML::PP::Parser
624           The Parser retrieves the tokens from the Lexer. The main YAML
625           content is then parsed with the Grammar.
626
627       YAML::PP::Grammar
628       YAML::PP::Constructor
629           The Constructor creates a data structure from the Parser events.
630
631       YAML::PP::Loader
632           The Loader combines the constructor and parser.
633
634       YAML::PP::Dumper
635           The Dumper will delegate to the Representer
636
637       YAML::PP::Representer
638           The Representer will create Emitter events from the given data
639           structure.
640
641       YAML::PP::Emitter
642           The Emitter creates a YAML stream.
643
644   YAML::PP::Parser
645       Still TODO:
646
647       Implicit collection keys
648               ---
649               [ a, b, c ]: value
650
651       Implicit mapping in flow style sequences
652           This is supported since 0.029 (except some not relevant cases):
653
654               ---
655               [ a, b, c: d ]
656               # equals
657               [ a, b, { c: d } ]
658
659       Plain mapping keys ending with colons
660               ---
661               key ends with two colons::: value
662
663       Supported Characters
664           If you have valid YAML that's not parsed, or the other way round,
665           please create an issue.
666
667       Line and Column Numbers
668           You will see line and column numbers in the error message. The
669           column numbers might still be wrong in some cases.
670
671       Error Messages
672           The error messages need to be improved.
673
674       Unicode Surrogate Pairs
675           Currently loaded as single characters without validating
676
677       Possibly more
678
679   YAML::PP::Constructor
680       The Constructor now supports all three YAML 1.2 Schemas, Failsafe, JSON
681       and Core.  Additionally you can choose the schema for YAML 1.1 as
682       "YAML1_1".
683
684       Too see what strings are resolved as booleans, numbers, null etc. look
685       at <https://perlpunk.github.io/YAML-PP-p5/schema-examples.html>.
686
687       You can choose the Schema like this:
688
689           my $ypp = YAML::PP->new(schema => ['JSON']); # default is 'Core'
690
691       The Tags "!!seq" and "!!map" are still ignored for now.
692
693       It supports:
694
695       Handling of Anchors/Aliases
696           Like in modules like YAML, the Constructor will use references for
697           mappings and sequences, but obviously not for scalars.
698
699           YAML::XS uses real aliases, which allows also aliasing scalars. I
700           might add an option for that since aliasing is now available in
701           pure perl.
702
703       Boolean Handling
704           You can choose between 'perl' (1/'', currently default), 'JSON::PP'
705           and 'boolean'.pm for handling boolean types.  That allows you to
706           dump the data structure with one of the JSON modules without losing
707           information about booleans.
708
709       Numbers
710           Numbers are created as real numbers instead of strings, so that
711           they are dumped correctly by modules like JSON::PP or JSON::XS, for
712           example.
713
714       Complex Keys
715           Mapping Keys in YAML can be more than just scalars. Of course, you
716           can't load that into a native perl structure. The Constructor will
717           stringify those keys with Data::Dumper instead of just returning
718           something like "HASH(0x55dc1b5d0178)".
719
720           Example:
721
722               use YAML::PP;
723               use JSON::PP;
724               my $ypp = YAML::PP->new;
725               my $coder = JSON::PP->new->ascii->pretty->allow_nonref->canonical;
726               my $yaml = <<'EOM';
727               complex:
728                   ?
729                       ?
730                           a: 1
731                           c: 2
732                       : 23
733                   : 42
734               EOM
735               my $data = $yppl->load_string($yaml);
736               say $coder->encode($data);
737               __END__
738               {
739                  "complex" : {
740                     "{'{a => 1,c => 2}' => 23}" : 42
741                  }
742               }
743
744       TODO:
745
746       Parse Tree
747           I would like to generate a complete parse tree, that allows you to
748           manipulate the data structure and also dump it, including all
749           whitespaces and comments.  The spec says that this is throwaway
750           content, but I read that many people wish to be able to keep the
751           comments.
752
753   YAML::PP::Dumper, YAML::PP::Emitter
754       The Dumper should be able to dump strings correctly, adding quotes
755       whenever a plain scalar would look like a special string, like "true",
756       or when it contains or starts with characters that are not allowed.
757
758       Most strings will be dumped as plain scalars without quotes. If they
759       contain special characters or have a special meaning, they will be
760       dumped with single quotes. If they contain control characters,
761       including <"\n">, they will be dumped with double quotes.
762
763       It will recognize JSON::PP::Boolean and boolean.pm objects and dump
764       them correctly.
765
766       Numbers which also have a "PV" flag will be recognized as numbers and
767       not as strings:
768
769           my $int = 23;
770           say "int: $int"; # $int will now also have a PV flag
771
772       That means that if you accidentally use a string in numeric context, it
773       will also be recognized as a number:
774
775           my $string = "23";
776           my $something = $string + 0;
777           print $yp->dump_string($string);
778           # will be emitted as an integer without quotes!
779
780       The layout is like libyaml output:
781
782           key:
783           - a
784           - b
785           - c
786           ---
787           - key1: 1
788             key2: 2
789             key3: 3
790           ---
791           - - a1
792             - a2
793           - - b1
794             - b2
795

WHY

797       All the available parsers and loaders for Perl are behaving
798       differently, and more important, aren't conforming to the spec.
799       YAML::XS is doing pretty well, but "libyaml" only handles YAML 1.1 and
800       diverges a bit from the spec. The pure perl loaders lack support for a
801       number of features.
802
803       I was going over YAML.pm issues end of 2016, integrating old patches
804       from rt.cpan.org and creating some pull requests myself. I realized
805       that it would be difficult to patch YAML.pm to parse YAML 1.1 or even
806       1.2, and it would also break existing usages relying on the current
807       behaviour.
808
809       In 2016 Ingy döt Net initiated two really cool projects:
810
811       "YAML TEST SUITE"
812       "YAML EDITOR"
813
814       These projects are a big help for any developer. So I got the idea to
815       write my own parser and started on New Year's Day 2017.  Without the
816       test suite and the editor I would have never started this.
817
818       I also started another YAML Test project which allows one to get a
819       quick overview of which frameworks support which YAML features:
820
821       "YAML TEST MATRIX"
822
823   YAML TEST SUITE
824       <https://github.com/yaml/yaml-test-suite>
825
826       It contains almost 400 test cases and expected parsing events and more.
827       There will be more tests coming. This test suite allows you to write
828       parsers without turning the examples from the Specification into tests
829       yourself.  Also the examples aren't completely covering all cases - the
830       test suite aims to do that.
831
832       The suite contains .tml files, and in a separate 'data' release you
833       will find the content in separate files, if you can't or don't want to
834       use TestML.
835
836       Thanks also to Felix Krause, who is writing a YAML parser in Nim.  He
837       turned all the spec examples into test cases.
838
839   YAML EDITOR
840       This is a tool to play around with several YAML parsers and loaders in
841       vim.
842
843       <https://github.com/yaml/yaml-editor>
844
845       The project contains the code to build the frameworks (16 as of this
846       writing) and put it into one big Docker image.
847
848       It also contains the yaml-editor itself, which will start a vim in the
849       docker container. It uses a lot of funky vimscript that makes playing
850       with it easy and useful. You can choose which frameworks you want to
851       test and see the output in a grid of vim windows.
852
853       Especially when writing a parser it is extremely helpful to have all
854       the test cases and be able to play around with your own examples to see
855       how they are handled.
856
857   YAML TEST MATRIX
858       I was curious to see how the different frameworks handle the test
859       cases, so, using the test suite and the docker image, I wrote some code
860       that runs the tests, manipulates the output to compare it with the
861       expected output, and created a matrix view.
862
863       <https://github.com/perlpunk/yaml-test-matrix>
864
865       You can find the latest build at <https://matrix.yaml.info>
866

CONTRIBUTORS

868       Ingy döt Net
869           Ingy is one of the creators of YAML. In 2016 he started the YAML
870           Test Suite and the YAML Editor. He also made useful suggestions on
871           the class hierarchy of YAML::PP.
872
873       Felix "flyx" Krause
874           Felix answered countless questions about the YAML Specification.
875

SEE ALSO

877       YAML
878       YAML::XS
879       YAML::Syck
880       YAML::Tiny
881       YAML::PP::LibYAML
882       YAML::LibYAML::API
883       <https://www.yaml.info>
884

SPONSORS

886       The Perl Foundation <https://www.perlfoundation.org/> sponsored this
887       project (and the YAML Test Suite) with a grant of 2500 USD in
888       2017-2018.
889
891       Copyright 2017-2022 by Tina Müller
892
893       This library is free software and may be distributed under the same
894       terms as perl itself.
895
896
897
898perl v5.36.0                      2022-10-03                       YAML::PP(3)
Impressum