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 döt Net',
modules => [
'YAML', 'YAML::Old', 'YAML::Perl', YAML::XS'
],
};
my $yaml = <<'...';
---
modules:
- YAML
- YAML::Old
- YAML::Perl
- YAML::XS
name: Ingy döt 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 döt Net <ingy@cpan.org>
COPYRIGHT
Copyright (c) 2008, 2009. Ingy döt Net.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See https://www.perl.com/perl/misc/Artistic.html
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page.
For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they're used to log you in.
Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task.
Learn more