Subject: | JE could play nicer with JSON |
Dumping the result of an eval using JSON.pm's to_json method croaks. This
is because rather than returning normal Perl hashes/arrays, eval returns
blessed objects.
If those blessed objects provided a TO_JSON method, then JSON.pm would
use that when dumping. This works:
*JE::Boolean::TO_JSON =
*JE::Null::TO_JSON =
*JE::Number::TO_JSON =
*JE::Object::TO_JSON =
*JE::String::TO_JSON =
*JE::Undefined::TO_JSON =
sub { (shift)->value };