The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

YAML::Hobo - Poor man's YAML

VERSION

version 0.2.0

SYNOPSIS

    use YAML::Hobo;

    $yaml = YAML::Hobo::Dump(
        {   release => { dist => 'YAML::Tiny', version => '1.70' },
            author  => 'ETHER'
        }
    );

    # ---
    # author: "ETHER"
    # release:
    #   dist: "YAML::Tiny"
    #   version: "1.70"

DESCRIPTION

YAML::Hobo is a module to read and write a limited subset of YAML. It does two things: reads YAML from a string – with Dump – and dumps YAML into a string – via Load.

Its only oddity is that, when dumping, it prefers double-quoted strings, as illustrated in the "SYNOPSIS".

YAML::Hobo is built on the top of YAML::Tiny. So it deals with the same YAML subset supported by YAML::Tiny.

WHY?

The YAML specification requires a serializer to impose ordering when dumping map pairs, which results in a "stable" generated output.

This module adds to this output normalization by insisting on double-quoted string for values whenever possible. This is meant to create a more familiar format avoiding frequent switching among non-quoted text, double-quoted and single-quoted strings.

The intention is to create a dull homogeneous output, a poor man's YAML, which is quite obvious and readable.

FUNCTIONS

Dump

    $string = Dump(list-of-Perl-data-structures);

Turns Perl data into YAML.

Load

    @data_structures = Load(string-containing-a-YAML-stream);

Turns YAML into Perl data.

CAVEAT

This module does not export any function. But it declares Dump and Load as exportable. That means you can use them fully-qualified – as YAML::Hobo::Dump and YAML::Hobo::Load – or you can use an importer, like Importer or Importer::Zim. For example,

    use zim 'YAML::Hobo' => qw(Dump Load);

will make Dump and Load available to the code that follows.

SEE ALSO

YAML::Tiny

AUTHOR

Adriano Ferreira <ferreira@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Adriano Ferreira.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.