NAME
YAML::Conditional - A conditional language within a YAML struct
VERSION
Version 1.01
SYNOPSIS
Quick summary of what the module does.
Perhaps a little code snippet.
use YAML::Conditional;
my $c = YAML::Conditional->new();
my $yaml = q|
for:
country: '{country}'
each: countries
else:
then:
rank: ~
elsif:
key: country
m: Indonesia
then:
rank: 2
if:
key: country
m: Thailand
then:
rank: 1
key: countries
|;
$json = $c->compile($yaml, {
countries => [
{ country => "Thailand" },
{ country => "Indonesia" },
{ country => "Japan" },
{ country => "Cambodia" },
]
});
...
countries:
- country: Thailand
rank: 1
- country: Indonesia
rank: 2
- country: Hawaii
rank: ~
- country: Canada
rank: ~
METHODS
new
Instantiate a new YAML::Conditional object. Currently this expects no arguments.
my $c = YAML::Conditional->new;
encode
Encode a perl struct into YAML.
$c->encode($struct);
encode
Encode a perl struct into YAML file.
$c->encode_file($file, $yaml);
decode
Decode a YAML string into a perl struct.
$c->decode($yaml);
decode_file
Decode a YAML file into a perl struct.
$c->decode_file($file);
compile
Compile a yaml string or file containing valid YAML::Conditional markup into either a yaml string, yaml file or perl struct based upon the passed params.
$c->compile($yaml, $params); # yaml string
$c->compile($yaml, $params, 1); # perl struct
$c->compile($yaml, $params, 0, $out_file); # yaml file
Markup or Markdown
For Markup see Struct::Conditional.
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-yaml-conditional at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=YAML-Conditional. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc YAML::Conditional
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2020->2021 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)