GithubHelp home page GithubHelp logo

yaml-perl6's Introduction

Perl6 YAML

Build Status

A YAML Loader and Dumper

INSTALLATION

Currently this depends on LibYAML.pm6

Install from Sources

You can install this YAML module from source like this:

$ zef install https://github.com/yaml/yaml-perl6.git
# or
$ git clone https://github.com/yaml/yaml-perl6.git
$ cd yaml-perl6
$ zef install .

Examples

The toplevel API is the first thing we want to get stable. The layer under that, the Loader/Dumper/Reader/Writer/Parser/Emitter will change, so it's not recommended to use that and think it will always work. Make sure to update LibYAML also when updating this module.

# current usage
use YAML;

my $yaml = q:to/./
    ---
    integer: 23
    map:
      a: true
      b: false
    sequence:
    - x
    - y
    - z
    ...
    ---
    This is: document no. 2
    ...
    .

# get back single document
# note that currently, this will parse the complete string instead
# of stopping after the first document
my $doc = yaml.load($yaml);
my %hash = yaml.load($yaml);

# load all documents
my @docs = yaml.all.load($yaml);
my $docs = yaml.all.load($yaml);

# dump data to YAML
my $yaml = yaml.dump(%data1, @data2, ...);
my @docs = (%data1, @data2);
my $yaml = yaml.dump(@docs);

Features

  • Load and Dump strings, numbers, booleans, arrays, hashes, (objects)
  • Load and Dump Aliases/Anchors, including cyclic structures

TODO

  • Tags
  • Files and Filehandles
  • Error messages
  • Allow other parsers/emitters as a backend
  • Other low level API stuff

SEE ALSO

YAMLish is a pure-perl6 module for YAML that doesn't rely on an external library like YAML currently does.

yaml-perl6's People

Contributors

ingydotnet avatar perlpunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

yaml-perl6's Issues

doesnt build on ubuntu 16.04 LTS

> src/build.sh 
gcc: error: unrecognized command line option ‘-W1,-soname,yamlwrap.so.1’
If you're running locally you may need to add this dir to LD_LIBRARY_PATH
  to do that, run: export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/martin/.workspace/p6/perl6-libyaml"

test failure using panda on debian

Tests failed using panda on debian.

Dependency TestML is installed:

$ panda --installed list | grep TestML
TestML                     -dependency-

Failed install:

$ panda install git://github.com/ingydotnet/yaml-pm6.git
==> Fetching YAML
==> Building YAML
==> Testing YAML
=== Test Dumping Perl 6 Data Objects to YAML ===
Could not find t::Bridge in:
    /path/to/.panda-work/1457228494_1/lib
    /home/david/.perl6/2016.02-85-g2c552d9
    /home/david/.rakudobrew/moar-nom/install/share/perl6/site
    /home/david/.rakudobrew/moar-nom/install/share/perl6/vendor
    /home/david/.rakudobrew/moar-nom/install/share/perl6
    CompUnit::Repository::AbsolutePath<48507312>
    CompUnit::Repository::NQP<45346656>
    CompUnit::Repository::Perl5<45346696>
  in method _transform_modules at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 163
  in method transform_modules at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 23
  in method get_transform_function at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 139
  in method evaluate_expression at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 105
  in block  at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 41
  in method run at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 36
  in block <unit> at t/dump.t line 3

t/dump.t ..... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 13/13 subtests 
=== Failing Tests For People to Hack On ===
Could not find t::Bridge in:
    /path/to/.panda-work/1457228494_1/lib
    /home/david/.perl6/2016.02-85-g2c552d9
    /home/david/.rakudobrew/moar-nom/install/share/perl6/site
    /home/david/.rakudobrew/moar-nom/install/share/perl6/vendor
    /home/david/.rakudobrew/moar-nom/install/share/perl6
    CompUnit::Repository::AbsolutePath<60144048>
    CompUnit::Repository::NQP<56983392>
    CompUnit::Repository::Perl5<56983432>
  in method _transform_modules at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 163
  in method transform_modules at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 23
  in method get_transform_function at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 139
  in method evaluate_expression at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 105
  in block  at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 41
  in method run at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 36
  in block <unit> at t/fail.t line 3

t/fail.t ..... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/1 subtests 
=== Various String Quoting ===
Could not find t::Bridge in:
    /path/to/.panda-work/1457228494_1/lib
    /home/david/.perl6/2016.02-85-g2c552d9
    /home/david/.rakudobrew/moar-nom/install/share/perl6/site
    /home/david/.rakudobrew/moar-nom/install/share/perl6/vendor
    /home/david/.rakudobrew/moar-nom/install/share/perl6
    CompUnit::Repository::AbsolutePath<76388832>
    CompUnit::Repository::NQP<73228176>
    CompUnit::Repository::Perl5<73228216>
  in method _transform_modules at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 163
  in method transform_modules at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 23
  in method get_transform_function at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 139
  in method evaluate_expression at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 105
  in block  at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 41
  in method run at /home/david/.rakudobrew/moar-nom/install/share/perl6/site/sources/A182E9F733D1C685F9F4F998B3332FE5B493FEBB line 36
  in block <unit> at t/strings.t line 3

t/strings.t .. 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/3 subtests 

Test Summary Report
-------------------
t/dump.t   (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 13 tests but ran 0.
t/fail.t   (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 1 tests but ran 0.
t/strings.t (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 3 tests but ran 0.
Files=3, Tests=0,  5 wallclock secs ( 0.02 usr  0.00 sys +  4.94 cusr  0.23 csys =  5.19 CPU)
Result: FAIL

double-quoted string value yields undefined (Any)

dmaestro$ perl6 -MYAML -e 'dd yaml.load("test.yml".IO.slurp)'
${:one(1), :three(Any), :two("one two")}
dmaestro$ perl -MYAML::XS -MData::Dumper -E 'undef $/; open my $yaml, "<", "test.yml"; my $hash = Load(<$yaml>); print Dumper($hash)'
$VAR1 = {
          'three' => 'one two three',
          'one' => 1,
          'two' => 'one two'
        };
dmaestro$ cat test.yml
---
one: 1
two: one two
three: "one two three"

The double-quoted string is parsed, but gives an undefined value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.