You are right, out of my app it works like expected. I have a helper in my plugin where $self->req->json still returns MOJO::JSON::_bool. I need to investigate it deeper. Sorry for this confusion.
W dniu środa, 11 marca 2015 17:04:57 UTC+1 użytkownik Dan Book napisał: > > Actually _decode_value from Mojo::JSON should also be overridden by the > monkey patching. Are you sure you have used the modules correctly? > > On Wed, Mar 11, 2015 at 10:06 AM, Dan Book <[email protected] <javascript:> > > wrote: > >> I submitted a PR for this issue. https://github.com/kraih/mojo/pull/758 >> Thanks! >> >> On Wed, Mar 11, 2015 at 8:59 AM, njzt <[email protected] <javascript:>> >> wrote: >> >>> >>>> Not sure why it hasn't been announced here, but there's Mojo::JSON_XS >>>> already. >>>> >>>> https://metacpan.org/pod/Mojo::JSON_XS >>>> >>>> -- >>>> sebastian >>>> >>> >>> I use this mentioned solution and recently I found one issue. There is >>> monkeypatch on MOJO::JSON::true (and false) which looks like: >>> >>> monkey_patch 'Mojo::JSON', 'true', sub { Cpanel::JSON::XS::true() }; >>> >>> and Mojo::JSON has following method: >>> >>> sub true () {$TRUE} >>> >>> >>> The problem is that in _decode_value Mojo::JSON still uses $TRUE >>> variable instead of calling correctly monkeypatched true() method, >>> >>> return $TRUE if /\Gtrue/gc; # seems that it would work with "return true()" >>> >>> >>> As the result all Boolean values are still decoded to Mojo::JSON::_Bool >>> which later are not handled correctly by JSON::XS encoder (with >>> allow_bleseed & convert_blessed enabled). Do you have some idea how can I >>> easily handle these boolean values? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Mojolicious" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> To post to this group, send email to [email protected] >>> <javascript:>. >>> Visit this group at http://groups.google.com/group/mojolicious. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
