Data-YAML
view release on metacpan or search on metacpan
lib/Data/YAML.pm view on Meta::CPAN
package Data::YAML;
use strict;
use warnings;
use vars qw{$VERSION};
$VERSION = '0.0.7';
1;
__END__
=head1 NAME
Data::YAML - Easy YAML serialisation of Perl data structures
=head1 VERSION
This document describes Data::YAML version 0.0.7
=head1 DESCRIPTION
In the spirit of L<YAML::Tiny>, L<Data::YAML::Reader> and
L<Data::YAML::Writer> provide lightweight, dependency-free YAML
handling. While C<YAML::Tiny> is designed principally for working with
configuration files C<Data::YAML> concentrates on the transparent round-
tripping of YAML serialized Perl data structures.
As an example of why this distinction matters consider that
C<YAML::Tiny> doesn't handle hashes with keys containing non-printable
characters. This is fine for configuration files but likely to cause
problems when handling arbitrary Perl data structures. C<Data::YAML>
handles exotic hash keys correctly.
The syntax accepted by C<Data::YAML> is a subset of YAML. Specifically
it is the same subset of YAML that L<Data::YAML::Writer> produces. See
L<Data::YAML> for more information.
=head2 YAML syntax
Although YAML appears to be a simple language the entire YAML
specification is huge. C<Data::YAML> implements a small subset of the
complete syntax trading completeness for compactness and simplicity.
This restricted syntax is known (to me at least) as 'YAMLish'.
These examples demonstrates the full range of supported syntax.
All YAML documents must begin with '---' and end with a line
containing '...'.
--- Simple scalar
...
Unprintable characters are represented using standard escapes in double
quoted strings.
--- "\t\x01\x02\n"
...
Array and hashes are represented thusly
---
- "This"
- "is"
- "an"
- "array"
...
---
This: is
a: hash
...
Structures may nest arbitrarily
---
-
name: 'Hash one'
value: 1
-
name: 'Hash two'
value: 2
...
Undef is a tilde
( run in 0.962 second using v1.01-cache-2.11-cpan-39bf76dae61 )