$v if defined $v;
}
addr_join(@addrs) || '';
};
# JSON formatting
$Directives{'json'} = {};
$Directives{'json'}{'*'}[0] =
$Directives{'json'}{'var'}[0] = sub {
my $self = shift;
my $opts = m
$opts);
$self->get_ctx->{'collapse'} = 0;
js_format($value, -opts => $opts);
};
$Directives{'json'}{'string'}[0] = sub {
my $self = shift;
my $name = shift;
my $addr = shift;
my $text = $
package Data::Hub::FileSystem::JSONFile;
use strict;
use Perl::Module;
use JSON::XS qw();
use base qw(Data::Hub::FileSystem::HashFile);
sub __parse {
my $tied = shift;
my $str = shift; # source s
ion hash
my $json = JSON::XS->new;
my $h = $$str ? $json->decode($$str) : {};
return overlay($data, $h);
}
sub __format {
my $tied = shift;
my $data = shift;
my $json = JSON::XS->new->asc
ii->pretty;
my $str = $json->encode(clone($data, -pure_perl));
return \$str;
}
sub __has_crown {
my $c = shift or return;
1;
}
1;
__END__
$$result .= _get_indent($level)._escape($value).$NEWLINE;
}
}
} elsif (isa($ref, 'JSON::XS::Boolean')) {
$$result .= _get_indent($level) .
$name.$SPACE.$LIT_ASSIGN.$SPACE.$
*HashFile\b');
# JSONFile
Add_Handler(q/Data::Hub::FileSystem::JSONFile/, '-type=!', '-path=\.json$');
Add_Handler(q/Data::Hub::FileSystem::JSONFile/, '-type=T', '-path=\.json$');
# YAMLFile
A
::JSONFile -
=head1 SYNOPSIS
=head1 EXPORTS
Nothing exported by default
=over
=back
=head1 DEPENDENCIES
This module requires these other modules and libraries:
Perl::Module
JSON::
n '"' . $key . '"';
}
sub format_value {
my $self = shift;
my $value = shift;
isa($value, 'JSON::PP::Boolean') and return $value ? 'true' : 'false';
isa($value, 'SCALAR') and $value = $$value