in reply to Re^2: Undefined import name priority issue?
in thread Undefined import name priority issue?
The issue seems to be the existance of a file in mylib with name 'json.pm'
No, half of the issue is that you are doing this:
use lib 'mylib'; use mylib::json;
You add the "mylib" directory to the module search path (@INC). In that case, your module should be simply named json and not mylib::json. If you want to load it as mylib::json, don't add the "mylib" directory to @INC, but the directory containing the "mylib" directory (i.e. "."). Older perls already include "." in @INC, that's why it probably works at all.
The second part of the issue is that your filesystem is not case sensitive. Do you see any difference between json and JSON? I see four different bits, but your filesystem does not. So when perl attempts to load "JSON.pm" containing the JSON package, it is fed "json.pm" containing the mylib::json package instead.
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Undefined import name priority issue?
by sectokia (Friar) on Apr 08, 2025 at 21:56 UTC | |
by ikegami (Patriarch) on Apr 09, 2025 at 02:25 UTC |