GLAST/LAT > DAQ and FSW > FSW
Introduction to FSW YAML usage
|
As discussed in the Document Mechanization and #DDF Entry Format tutorials, the FSW document production scripts make very heavy use of YAML, a data-serialization format which provides direct encodings for Perl's scalars, hashes, and lists. YAML has a very rich syntax, but the FSW scripts use only a small subset of it. On the other hand, certain local idioms (e.g., splittable text strings) are used to extend this subset. This tutorial describes the local style of YAML use, concentrating on the constructs and idioms which are found in FSW YAML files. YAML Basics
This example demonstrates most of the constructs which appear in FSW YAML files:
# This YAML snippet encodes a 2-element hash.
# Key1 is a hash entry, containing a 6-element list.
Key1:
- 1
- &foo abc
- *foo
- 'some text'
- >
a bit of
line-wrapped text
- |
A B C D E F G
1 2 3 4 5 6 7
# Key2 is another hash entry, containing a 2-element hash.
Key2:
foo: 123
bar: 456
'1.2': 789
Assuming that the above snippet has been loaded into memory and attached to the hashref $r, the following should be true:
YAML StandardizationAt the time that work began on the FSW document production scripts, the YAML specification was very much in flux. Even in early 2005, some fine points are still being hammered out. Efforts are under way to develop conforming emitters and parsers, but it could be months until they are reliably available. So, the version of YAML used in FSW YAML files follows a de facto specification: whatever is supported by Version 0.35 of Brian Ingerson's pure-Perl YAML.pm module. This has precluded the use of certain constructs, but the eventual standards-based parsers should have little trouble with FSW YAML usage. (If they do, YAML.pm can still be used. :-) Local YAML Idioms
|