kend::Json 2.155;
use Carp;
use strict;
use warnings;
use Config::Model::Exception;
use File::Path;
use Log::Log4perl qw(get_logger :levels);
use base qw/Config::Model::Backend::Any/;
use JSON;
my
$logger = get_logger("Backend::Json");
sub read {
my $self = shift;
my %args = @_;
# args is:
# object => $obj, # Config::Model::Node object
# root => './my_tes
xists; # no file to read
# load Json file
my $json = $args{file_path}->slurp_utf8;
# convert to perl data
my $perl_data = decode_json $json ;
if ( not defined $perl_data ) {
rl data structure to
highlight the content of a model. A Perl data structure is very
similar to a JSON structure. The only thing you need to know are:
=over
=item *
Curly braces C<{ ... }> contain
e 5.10.1;
use Mouse;
use Config::Model::Exception;
use Log::Log4perl qw(get_logger :levels);
use JSON;
use Path::Tiny;
use YAML::Tiny;
use feature qw/postderef signatures/;
no warnings qw/experiment
e,
},
fallback => {
':.rm' => \&_remove_by_id,
':.json' => \&_load_json_vector_data,
}
);
my %equiv = (
'hash_*' => { qw/:@ :.sort :.mo
return 'ok';
}
sub __load_json_file ($file) {
# utf8 decode is done by JSON module, so slurp_raw must be used
return decode_json($file->slurp_raw);
}
sub _load_json_vector_data {
my ( $s