YAML::Hobo - Poor man's YAML
version 0.2.0
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"
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.
Dump
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.
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.
$string = Dump(list-of-Perl-data-structures);
Turns Perl data into YAML.
@data_structures = Load(string-containing-a-YAML-stream);
Turns YAML into Perl data.
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,
YAML::Hobo::Dump
YAML::Hobo::Load
use zim 'YAML::Hobo' => qw(Dump Load);
will make Dump and Load available to the code that follows.
YAML::Tiny
Adriano Ferreira <ferreira@cpan.org>
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.
To install YAML::Hobo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm YAML::Hobo
CPAN shell
perl -MCPAN -e shell install YAML::Hobo
For more information on module installation, please visit the detailed CPAN module installation guide.