This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use 5.010; | |
use JSON (); | |
use JSON::PP (); | |
use JSON::XS (); | |
use Cpanel::JSON::XS (); | |
use Mojo::JSON (); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
key: long | |
value | |
split | |
into | |
several | |
lines | |
for | |
readability | |
key: "long | |
value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"type": "sequence", | |
"elements": [ | |
{ | |
"type": "int", | |
"value": "42" | |
}, | |
] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- &1 | |
links: | |
- &2 | |
links: | |
- *1 | |
name: B | |
- &3 | |
links: | |
- *1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use YAML; | |
use Data::Dumper; | |
my $yaml = <<"EOM"; | |
--- !!perl/hash:Foo | |
b: B | |
a: A | |
EOM | |
my $data = Load $yaml; | |
say Dumper $data; | |
say Dump $data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1.-3.: the resulting tag of a merged list or mapping will be the tag of the first item of the !!merge | |
--- # 1. set object tag in defaults | |
default-article: !article &defaults | |
foo: bar | |
theme: default-theme | |
article: !!merge | |
- *defaults | |
- theme: my-cool-theme | |
author: myself |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: run a command and save lines | |
command: ls -l *.yaml | |
register: files | |
- name: copy files | |
copy: | |
src: "{{ item }}" | |
dest: /path/{{ item }} | |
with_items: files.stdout_lines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
a: | |
b: &1 | |
abcde: &2 | |
- fghi | |
- jklm | |
- &3 | |
nopq: rstu | |
c: | |
- *1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Perl Numbers in JSON and YAML</title> | |
<style type="text/css"> | |
body { | |
font-family: Verdana, Arial; | |
} | |
table.numbers { | |
border: 1px solid #bbb; | |
border-collapse: collapse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
block mapping: | |
a: 1 | |
b: 2 | |
block sequence: | |
- a | |
- b | |
- c |