David R. Morrison wrote:
I think the problem here is that "perl Makefile.PL" will _use_ the value
of PERL5LIB which you have set in order to locate any modules necessary
during the creation of the Makefile, but will not _pass_ this value to the
Makefile itself in any useful manner.


Yes, I think that's exactly it -- and even worse, not only does $PERL5LIB/Test/Harness.pm not get passed, it even gets *overriden* by /System/Library/Perl/Test/Harness.pm, because the Makefile sets PERL_LIB = /System/Library/Perl and then includes it:

  test_dynamic :: pure_all
      PERL_DL_NONLAZY=1 $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB)
      -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests
      $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;'
      $(TEST_FILES)

(This is written by the "test_via_harness" method of ExtUtils::MM_Unix.) To reverse this, Ken Williams suggested calling "make test" with PERL_LIB=$PERL5LIB, but I'm not yet sure that this is always foolprof.


In Fink, "perl Makefile.PL" is called with a bunch of arguments:

perl Makefile.PL PREFIX=/sw \
 INSTALLPRIVLIB=/sw/lib/perl5 \
 INSTALLARCHLIB=/sw/lib/perl5/darwin \
 INSTALLSITELIB=/sw/lib/perl5 \
 INSTALLSITEARCH=/sw/lib/perl5/darwin \
 INSTALLMAN1DIR=/sw/share/man/man1 \
 INSTALLMAN3DIR=/sw/share/man/man3

(see the description of CompileScript at
http://fink.sourceforge.net/doc/packaging/reference.php#fields ).


...indeed, that's exactly where I took the flags mentioned in the original post :-) (And I'll take this opportunity to thank you for all your Fink work. Maybe some day you'll tell the rest of us how you manage this *and* your day job...)

I also browsed Fink CVS to see how you go about my problem for the modules that Fink distributes. (I guess they all come as dependencies for other packages, or is there any other reason for Fink to distribute perl modules?) However it looks like none of them need the new Test::Harness at present... but I guess this is bound to happen sooner or later. How would you go about it? Write a custom "make test"?


The relevant variables for you would presumably be the ...LIB ones.


Well, looking at the above excerpt from the Makefile, it seems that again, PERL_LIB is the only one we could usefully set (to $PERL5LIB). But I'm afraid that doing this at "perl Makefile.PL" time is too early in general... For this particular module the resulting Makefile happens to work, but the warning (below) leads me to believe that it wouldn't in general, no? (Cf. the problems when I set PERL_ARCHLIB earlier in this thread.)

[localhost:~/Getopt-ArgvFile-1.06] fz% perl Makefile.PL PERL_LIB=$PERL5LIB
Checking if your kit is complete...
Looks good
Warning: PERL_LIB (/Volumes/Unix/usrlocal/lib/perl5) seems not to be a perl library directory
(Exporter.pm not found) at (eval 9) line 367.
Writing Makefile for Getopt::ArgvFile



Looking again at the Makefile excerpt, another possibility that comes to mind is to set FULLPERL to "/usr/bin/perl -I$PERL5LIB". This ensures that the newly installed Test::Harness is selected, and it seems to work (see below). However I'm not sure what would happen if we have a module in PERL5LIB and try to install a newer version of it: will "make test" actually test the new one, or the old one? Seems like it could be the latter, and then... does anyone see if/how we could override that?




[localhost:~/Getopt-ArgvFile-1.06] fz% perl Makefile.PL FULLPERL="/usr/bin/perl -I$PERL5LIB"
Checking if your kit is complete...
Looks good
Writing Makefile for Getopt::ArgvFile
[localhost:~/Getopt-ArgvFile-1.06] fz% make
mkdir blib
mkdir blib/lib
mkdir blib/lib/Getopt
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/Getopt
mkdir blib/arch/auto/Getopt/ArgvFile
mkdir blib/lib/auto
mkdir blib/lib/auto/Getopt
mkdir blib/lib/auto/Getopt/ArgvFile
mkdir blib/man3
cp ArgvFile.pm blib/lib/Getopt/ArgvFile.pm
Manifying blib/man3/Getopt::ArgvFile.3
[localhost:~/Getopt-ArgvFile-1.06] fz% make test
PERL_DL_NONLAZY=1 /usr/bin/perl -I/Volumes/Unix/usrlocal/lib/perl5 -Iblib/arch -Iblib/lib -I/System/Library/Perl/darwin -I/System/Library/Perl -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/base......ok


t/prefix....ok

All tests successful.
Files=2, Tests=7, 1 wallclock secs ( 0.80 cusr + 0.32 csys = 1.12 CPU)




Reply via email to