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]

My example showing how Perl could find the module was actually perldoc -l which correctly identified the source as /home/henry/gitr/MAS/lib. So Perl's own module-search routines are working OK.

I tried the -I option, with the same baffling result:

/usr/bin/prove -I/home/henry/gitr/MAS/lib ./t/8bit.t ./t/8bit.t .. Can't locate MAS::Global in @INC (@INC entries checked: +/home/henry/gitr/MAS/lib ... etc

The section in the docs that you point out, that there's a separate set of options passed to "options passed to the perl which runs tests" is interesting; but use of the -I option, as it recommends, shows that that's not the problem either.

I remain baffled, and stymied ...

  • 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 atcroft (Abbot) on Dec 15, 2025 at 09:27 UTC

    Out of curiosity, what does your 'package' statement in the module look like? Is it something like package MAS::Global; , or package Global;?

    I ask because I did a quick test of some code I was working on recently. My code was under ./lib/My/Particle/Moveable.pm, and my test ran correctly if I used package My::Particle::Moveable; but not if I did package Moveable;. (I remember there was some reason for doing it one way and not the other, but I can't remember it at the moment.)

    Hope that helps.

      That's weird, because using a bareword replaces the :: with a slash, so the error should be
      Can't locate MAS/Global.pm in @INC (you may need to install the MAS::G +lobal module) (@INC contains: ... # ^ # | # slash

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      It's package MAS::Global;
Re^3: prove can't find my module, even though its directory is in $INC[0]
by LanX (Saint) on Dec 15, 2025 at 11:40 UTC
    > My example showing how Perl could find the module was actually perldoc -l which correctly identified the source as /home/henry/gitr/MAS/lib.

    Better don't count on that, AFAIR is perldoc using another mechanism to locate documentation.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      Rather try this
      $ perl -MMAS::Global -e0

      And compare the error message (if it occurs)

      Can't locate MAS/Global.pm in @INC (you may need to install the MAS::G +lobal module) (@INC entries checked: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/ +5.38.2 ... YADDA YADDA ... /usr/local/lib/site_perl). BEGIN failed--compilation aborted.

      next step would be to dump @INC inside a BEGIN{ } right before the use MAS::Global in order to spot differences to successful imports.

      perl -e'BEGIN {warn join " ",@INC};use MAS::Global'

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery