Friday, March 21, 2008

YAML and Legacy Perl

While rewriting some legacy Perl, I got the jonesin' for some YAML to drive the setup factory. Unfortunately, I'm working on an old system running older Perl. Fortunately YAML::Tiny came to the rescue, and worked as advertised. YAML::Tiny isn't a complete YAML parser, but it works well enough to translate things like this:

--- MLSMR report configuration file
REPORT_TYPE: MLSMR
MLSMR_ISM: ValuesFrequency
MLSMR_STRUCTURE_ID: ValuesFrequency
MLSMR_STRUCTURE_SYNONYMS: Exists
MLSMR_SAMPLE_ID: ValuesFrequency
PUBCHEM_SID: ValuesFrequency
FIELD_ORDER:
1: MLSMR_ISM MLSMR_STRUCTURE_ID MLSMR_STRUCTURE_SYNONYMS
2: MLSMR_SAMPLE_ID PUBCHEM_SID
And now someone else can configure those reports with a text editor.