Line 12 of JSON::WebToken is:
use JSON qw(encode_json decode_json);Perl's use statement is shorthand for:
BEGIN { require JSON; JSON->import(qw(encode_json decode_json)); }
.. and the key feature of require is that it loads the module only if it has not already been loaded. It checks that by looking in %INC.
My guess then is that JSON::XS is poking a value into %INC to make it look as if JSON itself has also already been loaded - but failing to define the JSON::import() method.
In the JSON::XS SYNOPSIS section I see:
# Note that JSON version 2.0 and above will automatically use JSON:: +XS # if available, at virtually no speed overhead either, so you should # be able to just: use JSON; # and do the same things, except that you have a pure-perl fallback +now.
.. so I suspect if you change your mylib::json to use JSON instead of use JSON::XS, it will probably make the problem disappear. If my diagnosis is correct, though, I'd call this a bug in JSON::XS.
In reply to Re: Undefined import name priority issue?
by hv
in thread Undefined import name priority issue?
by sectokia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |