I am building a Perl package using Module::Build. The tests t/*.t for the package have to use a program residing in a directory that a user should supply during invoking tests:
perl Build.PL
./Build
./Build test user-supplied-directory
The Module::Build documentation provides information on passing arguments to the Build script but I have not found how to pass them to a test. Is it possible?
Since one cannot set an environment variable in the same command line in Windows, I decided to change Build.PL for passing an environment variable to tests by subclassing Module::Build (Adding an action).
Now when user runs
the
user-supplied-directory
is passed to tests as$ENV{HUSKYBINDIR}
.Strange enough that the same command-line argument is passed as
$ARGV[1]
in Linux and as$ARGV[2]
in Windows. I had no opportunity to test it in FreeBSD and Mac OS X but hopefully, it will be$ARGV[1]
as in Linux.