in reply to Re^3: Undefined import name priority issue?
in thread Undefined import name priority issue?

Thanks: that is it exactly... should not have "use lib 'mylib';" at all, isn't needed because I want mylib.pm to reference mylib::json.

  • Comment on Re^4: Undefined import name priority issue?

Replies are listed 'Best First'.
Re^5: Undefined import name priority issue?
by ikegami (Patriarch) on Apr 09, 2025 at 02:25 UTC

    You shouldn't have used use mylib; if you use use mylib::json; and if the module uses package mylib::json;, correct.

    You shouldn't have used use lib in modules. If you got that far, Perl already knows where modules can be found.

    You shouldn't have used use lib '.'; because the current work directory isn't guaranteed to be the script's directory. You should be using

    use FindBin qw( $RealBin ); use lib $RealBin;