zerohero has asked for the wisdom of the Perl Monks concerning the following question:

Is there a good YAML "pretty printer"? Something that does recursive indenting, and might even try to make visually pleasing blocks of text (e.g. arrays of numbers which line up)?

The default output I get from YAML::XS::Dump () doesn't look so good (it's extremely vertical - no inlining of arrays). Since YAML is supposed to be human readable, it would be good if there was something that did a decent job of output formatting (provided with some hints maybe).

Replies are listed 'Best First'.
Re: YAML output formatting
by BioLion (Curate) on Jul 03, 2009 at 15:09 UTC

    YAML::Tiny does more or less the same and is very lightweight (obv.!)...
    If you want something specific with proper in-lining and aligned columns etc... you are probably better off writing your own, maybe with printf()?
    Maybe starting from something like this: http://docstore.mik.ua/orelly/perl/advprog/ch02_05.htm?

    Just a something something...

      I like the something something, I'll give it a try.

Re: YAML output formatting
by Anonymous Monk on Jul 03, 2009 at 13:57 UTC