=> 1,
# allow_encodings => undef, # or ['base64','json',...]
# disallow_encodings => undef, # or ['base64','json',...]
# allow_directives => undef, # or ['include','merge
as verbatim. Example:
name = !json null
With C<enable_encoding> turned off, value will not be undef but will be string
with the value of (as Perl literal) C<"!json null">.
B<NOTE: Turning this se
f violates IOD specification.>
=head2 enable_bracket => bool (default: 1)
If set to false, then JSON literal array will be parsed as verbatim. Example:
name = [1,2,3]
With C<enable_bracket> turne
nput => <<'_',
name=!json "1\n2"
_
dies => 1,
);
test_read_iod(
args => {allow_encodings=>['json']},
input => <<'_',
name=!json "1\n2"
name2=!j "3\
allow_encodings=>['json']},
input => <<'_',
name=!json "1\n2"
_
dies => 1,
);
test_read_iod(
args => {disallow_encodings=>['json']},
in
t_read_iod(
args => {disallow_encodings=>['hex']},
input => <<'_',
name=!json "1\n2"
_
result => {GLOBAL=>{name=>"1\n2"}},
);
};
subtest "opt: all
$4, # COL_V_COMMENT
] if $needs_res;
# canonicalize shorthands
$enc = "json" if $enc eq 'j';
$enc = "hex" if $enc eq 'h';
$enc = "expr" if $enc eq 'e';
if grep {$_ eq $enc} @{$self->{disallow_encodings}};
}
if ($enc eq 'json') {
# XXX imperfect regex for simplicity, comment should not contain
# "
)(.*) )?
\z/x or return ("Invalid syntax in JSON-encoded value");
my $decode_res = $self->_decode_json($val);
return ($decode_res->[1]) unless $decode_res-