I built myself a new Perl module using Module::Starter, it has the following source code files in lib/:
Foo/Bar.pm
Spam.pm
I make two test cases in t/Bar.t that test Foo/Bar.pm. I ran:
perl Makefile.PL && make && make test
it shows that my 2 test cases are passed.
Bar.pm defines:
package Foo::Bar;
Spam.pm uses it in this way:
use Foo::Bar qw(fun);
Despite that test cases can find Foo::Bar no problem, however when I ran Spam.pm individually by perl Spam.pm, it reports that Foo::Bar cannot be found in @INC.
What am I doing wrong?
<project root>/libis generally not in your include path (your@INCsetting).make testwill include it (actuallyblib/lib), but to include it in a standalone program during module development you have to do one ofOr install it (with
make install), which will make the files available under a directory that is in your include path.