in reply to Re: Re: Re: Re: Makefile.PL even weirder on Windows
in thread Makefile.PL even weirder on Windows

Sometimes I wish the @INC paths had "same directory as the main script" option!

I think I've done something like this before. The following is untested:

BEGIN { use File::Basename; my $dir = dirname(__FILE__); unshift @INC, $dir; require MyModule; }
If your module has functions, you can just use the whole package/function name to refer to them in your test, e.g. MyModule::function(@args), or explicitly call MyModule->import after the require. This way, I can run the tests from any directory, even from outside of the whole build directory.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Makefile.PL even weirder on Windows
by John M. Dlugosz (Monsignor) on Jan 14, 2003 at 04:51 UTC
    I thought about that before writing the code, but since I'm specifically testing the use statement itself, I didn't want to "fake it" or alter it in any way. That's why I have separate files at all instead of just putting them into the test script.

    Good point about using __FILE__. I kind of forgot about that, but use $0.

    —John