|Keep It Simple, Stupid|
tod222's scratchpadby tod222 (Pilgrim)
|on Jul 31, 2008 at 21:53 UTC||Need Help??|
Mini-tip: Use a private extension to Module::Install to make tests_recursive follow symlinks
Module::Install's Module::Install::Makefile implements a nifty function called tests_recursive which you can put in your Makefile.PL to run all the tests in subdirectories under t.
While it uses File::Find's find function, tests_recursive doesn't allow you to set the follow option to have symbolic links be followed.
This can be accomplished with a private extension. The pod for Module::Install is a little unclear, so here's an example.
First, create the private extension file, in this case under 'ext'.
Contents of ext/Module/Install/PRIVATE.pm (this is basically a cut and paste from Module/Install/Makefile.pm with a trivial change):
Second, edit Makefile.PL to add 'ext' to the @INC path so Module::Install finds it and to call the new function.
Contents of Makefile.PL (changes/additions commented):
Caveat: Symlinks won't work across platforms! This modification is only useful for developer and other special tests that aren't going to run automatically when the package is installed. The files in the symlinked directories under t aren't listed in MANIFEST. For user's reference, they can be shipped in another location outside the t directory, thus the need for symlinks.