in reply to Re: prove can't find my module, even though its directory is in $INC[0]
in thread prove can't find my module, even though its directory is in $INC[0]

No, the test file t/8bit.t uses a simple use MAS::Global;. I just checked.
  • Comment on Re^2: prove can't find my module, even though its directory is in $INC[0]
  • Download Code

Replies are listed 'Best First'.
Re^3: prove can't find my module, even though its directory is in $INC[0]
by ikegami (Patriarch) on Dec 15, 2025 at 16:40 UTC

    You said you got this error message:

    Can't locate MAS::Global in @INC [...]

    The error message indicates that Perl is looking for a file named MAS::Global when you want it to look for a file named MAS/Global.pm.

    This happens, like choroba said, when require "MAS::Global"; is used instead of require MAS::Global; or require "MAS/Global.pm";.

    $ perl -e'require "MAS::Global";' # Bad Can't locate MAS::Global in @INC [...] at -e line 1. $ perl -e'require MAS::Global;' # Ok Can't locate MAS/Global.pm in @INC [...] at -e line 1. $ perl -e'require "MAS/Global.pm";' # Ok Can't locate MAS/Global.pm in @INC [...] at -e line 1.

    So check again, because require "MAS::Global"; or equivalent is definitely used somewhere in your code. The full error message will even say in what file and on what line. Add use Carp::Always; if you need a stack trace.

    If you're still unable to find the problem, start by providing the full (unedited) error message.


    In case you need it, the following is a portable method of converting a package name to a path for require:

    # Equivalent to what `if.pm` uses. my $require_path = $pkg_name =~ s{::}{/}gr . ".pm";