Config::UCL - Perl bindings for libucl
use Config::UCL; use JSON::PP qw(to_json); my $hash = ucl_load("key1 : val1"); say to_json $hash; # {"key1":"val1"} my $text = ucl_dump($hash); say $text; # key1 = "val1"; # libucl-0.8.1/tests/schema/required.json my $data1 = { foo => 1 }; my $data2 = { bar => 1 }; my $schema = { properties => { foo => {}, bar => {}, }, required => [qw(foo)], }; say ucl_validate($schema, $data1); # 1 say ucl_schema_error(); # say ucl_validate($schema, $data2); # say ucl_schema_error(); # object has missing property foo
$opt hash reference is optional.
Passed to ucl_parser_new(). https://github.com/vstakhov/libucl/blob/master/doc/api.md#ucl_parser_new
UCL_PARSER_DEFAULT (default) UCL_PARSER_KEY_LOWERCASE UCL_PARSER_ZEROCOPY UCL_PARSER_NO_TIME UCL_PARSER_NO_IMPLICIT_ARRAYS UCL_PARSER_SAVE_COMMENTS UCL_PARSER_DISABLE_MACRO UCL_PARSER_NO_FILEVARS
Passed to ucl_string_flags ucl_object_fromstring_common(). https://github.com/vstakhov/libucl/blob/master/doc/api.md#ucl_object_fromstring_common
UCL_STRING_RAW UCL_STRING_ESCAPE (default) UCL_STRING_TRIM UCL_STRING_PARSE_BOOLEAN UCL_STRING_PARSE_INT UCL_STRING_PARSE_DOUBLE UCL_STRING_PARSE_TIME UCL_STRING_PARSE_NUMBER UCL_STRING_PARSE UCL_STRING_PARSE_BYTES
Passed to ucl_duplicate_strategy ucl_parser_add_chunk_full().
UCL_DUPLICATE_APPEND (default) UCL_DUPLICATE_MERGE UCL_DUPLICATE_REWRITE UCL_DUPLICATE_ERROR
UCL_PARSE_UCL (default) UCL_PARSE_MSGPACK UCL_PARSE_CSEXP UCL_PARSE_AUTO
The UTF8 flag of the key and value is turned on.
$opt is the same as ucl_load().
Internally ucl_parser_set_filevars() is called and ${CURDIR} is set.
Passed to ucl_object_emit(). https://github.com/vstakhov/libucl/blob/master/doc/api.md#emitting-functions-1
UCL_EMIT_JSON (default) UCL_EMIT_JSON_COMPACT UCL_EMIT_CONFIG UCL_EMIT_YAML UCL_EMIT_MSGPACK UCL_EMIT_MAX
The UTF8 flag of the value is turned on.
Returns true or false.
If it is false, you can get the error string with ucl_schema_error().
https://github.com/vstakhov/libucl
Tomohiro Hosaka, <bokutin@bokut.in>
The Config::UCL module is Copyright (C) 2020 by Tomohiro Hosaka.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.
To install Config::UCL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::UCL
CPAN shell
perl -MCPAN -e shell install Config::UCL
For more information on module installation, please visit the detailed CPAN module installation guide.