use JSON::Parse; my $JP = JSON::Parse->new(); $JP->warn_only(); $JP->warn_only(1); #### JSON::Parse->warn_only($JP, 'on'); #### Usage: JSON::Parse::warn_only(parser, onoff) #### JSON::Parse::warn_only: parser is not of type JSON::Parse #### $j->warn_only(1); #### use strict; use warnings; use JSON::Parse 0.38; use Data::Dumper; my $j = JSON::Parse->new(); # no complain, no effect: $j->warn_only(1); # legal json: my $pl = $j->run('{"k":"v"}'); print Dumper($pl); print "I am not dead 1\n"; # illegal json, the following statement dies: $pl = $j->run('illegal json'); print Dumper($pl); print "I am not dead 2\n"; #### $VAR1 = { 'k' => 'v' }; I am not dead 1 JSON error at line 1, byte 1/12: blah blah blah at which point it has died.