Re^3: Do Pure Perl CPAN packages really need to use ExtUtils::Command::MM?by Eliya (Vicar)
|on Feb 17, 2011 at 21:55 UTC||Need Help??|
...I am referring to the contents of @INC before any script calls use lib or any command line sets and exports PERL5LIB.
I'm not saying this is the recommended way to do it, but technically, the following should work:
Set PERL5LIB in the Makefile
As any command being run for the "test" target (or any other target) is a subprocess of make, it will inherit the environment variable, so the lib dir is being added to @INC for all tests.
What remains to be solved is how to get MakeMaker to put the above line in the generated Makefile. A quick test shows that this can be achieved by overriding the routine post_initialize, which is responsible for creating a (normally empty) section at the beginning of the Makefile. I.e., add a MY::post_initialize routine to your Makefile.PL:
This generates a section in the Makefile
which causes make to set PERL5LIB in its environment.