YAML::Perl(3p)

NAME
YAML::Perl - Pure Perl YAML Implementation

WARNING
This is an early release of PyYaml ported to Perl. Don't even bother to try this version.

Still here?

This port is nearing completion. Most stuff works including:

    * Loading and dumping of basic types
    * Block and flow styles (JSON Loading)
    * Blessed hashes arrays and scalars
    * References
    * Tags
    * Detailed error messages
    * Lot's of new stuff like parser/emitter streaming api

You can play with it by using:

    ysh -MYAML::Perl

TODO
    * Review all code ported so far
    * Port diff from old copy of pyyaml to current version
    * Do all the utf8 related code porting that I've ignored
    * Port the pyyaml test suite to Perl
      * Get all tests to pass
    * Support esoteric Perl types like regexps and globs
    * Support the PyYAML tag resolution API
    * Write full documentation for YAML::Perl
    * Support YAML::Node from YAML::Perl

SYNOPSIS
    use YAML::Perl;

    my $data = {
        name => 'Ingy doet Net',
        modules => [
            'YAML', 'YAML::Old', 'YAML::Perl', YAML::XS'
        ],
    };

    my $yaml = <<'...';
    ---
    modules:
    - YAML
    - YAML::Old
    - YAML::Perl
    - YAML::XS
    name: Ingy doet Net
    ...

    # Simple, familiar, Dump/Load API
    my $yaml2 = Dump $data;
    my $data2 = Load $yaml;

    # New, non-global dump API:
    my $yaml3 = YAML::Perl->new->dumper(%options)->dump($data);

    # New load API
    my $data3 = YAML::Perl->new->loader(%options)->open($yaml)->load();

    # New Streaming Parser/Emitter API
    my $yaml4;
    my $parser = YAML::Perl->new->parser->open($yaml);
    my $emitter = YAML::Perl->new-emitter->open($yaml4);
    while (my $event = $parser->parse()) {
        # Do various things with events here
        $emitter->emit($event);
    }
    $emitter->close;
    print $yaml4;

DESCRIPTION
PyYAML is the most robust and correct YAML module for a dynamic language. It is (obviously) written in/for Python. This module is a complete port of PyYAML to Perl.

STREAMING API
YAML::Parser reads a YAML serialization stream and produces events. YAML::Emitter takes YAML events and produces a YAML serialization stream.

Both of these modules allow you to process all the yaml/events at once, or do things one event at a time. If you call the YAML::Parser "parse()" method in list context, you get all the remaining event objects. If you call it in scalar context, you get the next event.

The YAML::Emitter "emit()" method takes one or more event objects as input arguments.

AUTHOR
Ingy doet Net <ingy@cpan.org>

COPYRIGHT
Copyright (c) 2008, 2009. Ingy doet Net.

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

See http://www.perl.com/perl/misc/Artistic.html