in reply to Suggestions for design of a config/rules file
Use YAML. Here are just some highlights. Use YAML. It obviates the need to reinvent the wheel. Use YAML. It's easy.
NOTES ON DATASTRUCTURE
The easiest way to visualize and understand the data structure:
it is just like an Excel 'spreadhsheet workbook'. Each 'worksheet'
represents an element of your model. Each worksheet holds one and
only one 'table'.
You can create any level of heirarchy with this
model simply by adding 'links'. You can easily translate this model
in and out of a database because everything is organized as tables.
You can easily translate this model into a directed graph. You
can easily translate this model into just about *anything* you can
represent digitally.
NOTES ON FIELDS
ADDITIONAL CONSIDERATIONS
### INIT script use strict; use warnings; use YAML; use Data::Dumper; my $dataroot = YAML::Load(join "", (<DATA>)); print $dataroot->{person}[0]{fname}; print "\n------------------\n"; print $dataroot->{person}[0]{lname}; print "\n------------------\n"; print $dataroot->{person}[0]{city}{caption}; print "\n------------------\n"; print Data::Dumper->Dump([$dataroot], [qw(dataroot)]); print "\n------------------\n"; 1; __END__ country: - &IDxCountryA name: CountryA caption: Country Alpha - &IDxCountryB name: CountryB caption: La Cuidad Del B - &IDxCountryC name: CountryC caption: United C Emirates state: - &IDxStateWashatovia name: washatovia caption: Washatovia country: *IDxCountryC - name: nervada_dc caption: Nervada D.C. country: *IDxCountryC city: - &IDxCityParisis name: Parisis caption: Parisis person: - fname: Samir lname: Krishnamurty city: *IDxCityParisis state: *IDxStateWashatovia country: *IDxCountryC
|
|---|