NAME
YAML::Ordered::Conditional - A conditional language within an ordered YAML struct
VERSION
Version 0.04
SYNOPSIS
use YAML::Ordered::Conditional;
my $c = YAML::Ordered::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::Ordered::Conditional object. Currently this expects no arguments.
my $c = YAML::Ordered::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::Ordered::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-ordered-conditional at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=YAML-Ordered-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::Ordered::Conditional
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=YAML-Ordered-Conditional
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2024 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)