JSON::XS “Usage” croak
问题 I can't seem to use JSON::XS 's OO interface properly. The following croaks with an error I can't track down: use JSON::XS; my $array = ['foo', 'bar']; my $coder = JSON::XS->new->utf8->pretty; print $coder->encode_json($array); This croaks with the following: Usage: JSON::XS::encode_json(scalar) at test.pl line 5. I have been combing through the code for JSON::XS and I can't find a "Usage:" warning anywhere. My usage seems to be pretty well matched with the examples in the documentation. Can