On 2011-11月-09 水 22:46:27, MATHEW wrote:
Show quoted text> Unsure about the max_depth problem, but it appears there is a more
> general problem with convert_blessed_universally... which is that is
> doesn't work.
Show quoted text> use JSON -convert_blessed_universally;
>
> my $x = bless { a => 1, b => 2 }, 'ME';
>
> to_json( $x ) ;
>
>
> This fails with the error message:
>
> encountered object 'ME=HASH(0x1d7adf0)', but neither allow_blessed nor
> convert_blessed settings are enabled at /usr/share/perl5/JSON.pm line
> 140
This is not a bug. You msut write the code:
to_json( $x, { allow_blessed => 1, convert_blessed => 1 } ) ;
Regards,