[VPM] Solution for the MakeMaker question

Peter Scott Peter at PSDT.com
Tue Sep 7 10:42:36 CDT 2004

>In case anyone was interested in the solution to the question I 
>posted on August 30 of subject "MakeMaker question", I have it here.
>In order for 'make test' to see a perl module that is being stored 
>under the t/ directory in a Perl module distribution, rather than 
>the lib/ directory with the main modules, I found that adding a 
>simple "use lib 't/';" (or in my case, "use lib 't/lib/';") to the 
>top of each of my t/*.t files did the trick.  No change to the 
>Makefile.PL necessary.

Been busy with travel, just got to this.

I have had the same problem and I believe I've solved it the same 
way.  The only thing I do differently is that I want to be able to 
execute my tests individually, and not be constrained to running them 
from the parent directory.  So I do either a

	use lib qw(t/lib lib);

or use FindBin depending on whim.  Then I can

	cd t

with impunity.

>FYI: My having asked the question to you in the first place was due 
>to some mistaken assumptions on my part as to what happens during 
>the install process.  For one thing, I had assumed that 'make' would 
>be copying the test files to some special location known to it, 
>somewhere under blib/, and so I would have no idea for where to make 
>a "use lib ..." point to.  Also, I had assumed that "use lib ..." 
>only took absolute paths such as "/home/user/foo" (I only saw it 
>used that way before) and hence I couldn't use it because I didn't 
>know the layout of the end user's system.  Taken together, I thought 
>MakeMaker would have to calculate some things.  However, now that I 
>know that, 1, "use lib ..." can take relative paths, and 2, the 
>current working directory *during* the tests remains the same as 
>where you were before starting the install process, everything looks 
>much simpler, and my bad assumptions are gone.
>So, all's well that end's well.  Thanks to Tim Bunce for pointing me 
>in the right direction.

More information about the Victoria-pm mailing list