Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use true/false functions instead of variables to allow monkey-patched Mojo::JSON #758

Merged
merged 1 commit into from Mar 11, 2015

Conversation

Grinnz
Copy link
Contributor

@Grinnz Grinnz commented Mar 11, 2015

Fixes _decode_value() to use the true and false functions in case they have been monkey patched to return different boolean objects, e.g. by Mojo::JSON::MaybeXS.

@kraih
Copy link
Member

kraih commented Mar 11, 2015

What's the performance cost?

kraih added a commit that referenced this pull request Mar 11, 2015
use true/false functions instead of variables to allow monkey-patched Mojo::JSON
@kraih kraih merged commit b8e8cdf into mojolicious:master Mar 11, 2015
@kraih
Copy link
Member

kraih commented Mar 11, 2015

There is a cost, but it's not that bad.

@Grinnz
Copy link
Contributor Author

Grinnz commented Mar 11, 2015

Any cost is certainly mitigated by being able to use XS-based JSON encoders anyway ;)

@kraih
Copy link
Member

kraih commented Mar 11, 2015

And reverted, since modules like Mojo::JSON::MaybeXS should always be monkey patching all functions exported by Mojo::JSON. 997873f

@Grinnz Grinnz deleted the json_bools branch March 11, 2015 16:13
@kberov
Copy link
Contributor

kberov commented Mar 12, 2015

The other day I was considering to monkey patch Mojo::JSON. I think it would be very beneficial to make Mojo::JSON to use internally JSON::XS if installed?..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants