Both ExtUtils::MakeMaker and Module::Build will stage scripts that are to be installed into blib/script. The former can be specified with EXE_FILES and the latter by script_files. When make test or Build test or prove -blib is run, the staged script should instead be tested. Testing for $ENV{HARNESS_ACTIVE} can be used to tell which script location to choose.