in reply to Re: JSON::Parse how to warn_only()?
in thread JSON::Parse how to warn_only()?

I concur that this works, unfortunately, it doesn't affect the parsing functions. If you treat the functions as object methods, things break, because the functions aren't expecting the object as its first parameter.

It seems that there's a discrepancy between the docs and the functionality (appears to be both, but I'm not positive). If nobody else can confirm by EOD today, I'll open a bug report (if it's not done by then), and simply link to this thread as it has all of the relevant information.

I don't use JSON::Parse (I use JSON), but a possible alternative would be to use eval:

my $perl; my $ok = eval { $perl = parse_json('[x]'); 1; }; if (! $ok){ warn "json load failed...\n"; ...; # do something else }