Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/JSON/PP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sub encode_json ($) { # encode
}


sub decode_json { # decode
sub decode_json ($) { # decode
($JSON ||= __PACKAGE__->new->utf8)->decode(@_);
}

Expand Down
21 changes: 21 additions & 0 deletions t/gh_54_context_sensitive_read_file.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use strict;
use warnings;
use Test::More;

BEGIN { plan tests => 1 };

BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }

use JSON::PP;

my $ds = eval { JSON::PP::decode_json read_file() };
ok !$@, "No error" or note $@;

sub read_file {
my $json = <<"JSON";
{
"camel": "Amelia"
}
JSON
wantarray ? split(/\R/, $json) : $json;
}