Fix prototype mismatch warning for JSON functions.#182
Fix prototype mismatch warning for JSON functions.#182deven wants to merge 1 commit intovanstyn:masterfrom
Conversation
|
I'm not sure that fixing the warning is the right thing to do. The RapidApp MixedEncoder is not compatible with the JSON module in the first place (MixedEncoder is writing javascript, where JSON module is strictly json) and it depends on using JSON::PP internally. So, if you |
The prototypes used in RapidApp::JSON::MixedEncoder for encode_json() and decode_json() match the respective prototypes in JSON::XS, but they don't match the prototypes used for those functions in Cpanel::JSON::XS, which JSON::MaybeXS will use in preference to JSON::XS. This can be easily demonstrated by including both modules: $ perl -MJSON::MaybeXS -MRapidApp::JSON::MixedEncoder -e 0 Prototype mismatch: sub main::encode_json ($;$) vs ($) at /usr/share/perl/5.26/Exporter.pm line 66. at -e line 0. Prototype mismatch: sub main::decode_json ($;$$) vs ($) at /usr/share/perl/5.26/Exporter.pm line 66. at -e line 0. RapidApp uses Catalyst, which uses JSON::MaybeXS, causing this prototype mismatch warning. This commit fixes this problem by using JSON::MaybeXS where the JSON module was previously used, and changing the prototypes for encode_json() and decode_json() in RapidApp::JSON::MixedEncoder to match the prototypes in Cpanel::JSON::XS, rather than JSON::XS. Note that this change means that using RapidApp::JSON::MixedEncoder with either JSON::XS or JSON will now cause a prototype mismatch warning!
d66826c to
37c10d5
Compare
@nrdvana - is it a good thing to merge in your opinion? I haven't found the time to look closely and probably won't for a while. as I recall you wrote MixedEncoder not me... |
|
@deven - also and separately, one of you will need to investigate the CI test fails before it can be considered for merge |
The prototypes used in RapidApp::JSON::MixedEncoder for encode_json()
and decode_json() match the respective prototypes in JSON::XS, but they
don't match the prototypes used for those functions in Cpanel::JSON::XS,
which JSON::MaybeXS will use in preference to JSON::XS.
This can be easily demonstrated by including both modules:
$ perl -MJSON::MaybeXS -MRapidApp::JSON::MixedEncoder -e 0$;$ ) vs ($) at /usr/share/perl/5.26/Exporter.pm line 66.$;$ $) vs ($) at /usr/share/perl/5.26/Exporter.pm line 66.
Prototype mismatch: sub main::encode_json (
at -e line 0.
Prototype mismatch: sub main::decode_json (
at -e line 0.
RapidApp uses Catalyst, which uses JSON::MaybeXS, causing this prototype
mismatch warning. This commit fixes this problem by using JSON::MaybeXS
where the JSON module was previously used, and changing the prototypes
for encode_json() and decode_json() in RapidApp::JSON::MixedEncoder to
match the prototypes in Cpanel::JSON::XS, rather than JSON::XS.
Note that this change means that using RapidApp::JSON::MixedEncoder with
either JSON::XS or JSON will now cause a prototype mismatch warning!