Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: An Idiot's Guide to YAML

by mr_mischief (Monsignor)
on Jun 09, 2007 at 06:25 UTC ( [id://620149]=note: print w/replies, xml ) Need Help??


in reply to Re^4: An Idiot's Guide to YAML
in thread An Idiot's Guide to YAML

If it does, so what?

Colon-delimited files are great for strictly table-natured data. CSV is great for slightly more complex table-natured data.

Windows-style INI files are widely supported and can handle grouping. Unfortunately, many things which look a little like them are found in the wild.

XML is verbose, but it's standard, well-supported, and can represent arbitrarily complex relationships. Perl hashes are, within Perl programs, exactly as flexible on all three counts. They do come up a bit short if one decides to port a Perl program to another language, as either the config format changes or you end up having to parse Perl hashes in another language. Parsing Perl's hash syntax shouldn't be that difficult, but chances are the other language already has an XML library or seven.

YAML seems to be an interesting solution to not much of a problem. I applaud you for wanting to learn it because it's interesting. That's enough reason to learn something. As for useful purpose, the legibility does seem nice from the examples I've seen. A lay person might be taught how to write it without being much intimidated. However, I think the standard for dealing with lay people these days is a pretty configuration wizard. So that, I think, limits the truest audience for YAML as a configuration tool to non-programming sysadmins.

Replies are listed 'Best First'.
Re^6: An Idiot's Guide to YAML
by Anonymous Monk on Jan 09, 2008 at 18:54 UTC

    The frontier between what is a data and a configuration format seems sometime quite blurry.

    INI are nice except when you have really nested information structure. They probably should only be used as configuration file, not as data store or worse read-write configuration files with some program state ad/or piece if code stored inside (I have seen both). If only because I may want to store configuration files on read-only media. And as previously highlighted by mr_mischief the INI format knows some various subtly incompatible variations.

    XML is so well known for its abuses that there is no need to list them. But supported nearly everywhere it is a good language for serialization and multiplatform exchange. A use of XML that makes me seriously sick is XML as configuration file. For anything beyond simple parameters XML files are simply too verbose and have such a low ration informatio/noise that they become nightmarish (ex: most Java application servers hell). Please say no to XML configs !

    YAML fits well between those too : as a light serialization language or for complex configurations, it is quite simple to parse (simpler than XML at least) and can represent complex structures very lisibly.

    Using Perl code as configuration has the problem of executable code in config file which can induce tricky security problem and is at least more complicated to securize system (executable code on noexec partitions ?). Perl as data format, well … do you want to execute code coming from an external program in yours ?

    Anyway thanks to superdoc for his helpful post (I did exact the same misreading …).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://620149]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-03-19 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found