On Mon, 01 Apr 2002 02:52:20 GMT, [EMAIL PROTECTED] (Stephen Zander)
wrote in news:87hemwyvtn.fsf@;pobox.com: 

> [...] looking to invoke perl as part of his test scripts and given
> that the test suite will usually be invoked using FULLPERL, it makes
> sense to me to use that for any additional perl invocations inside
> that test suite.  Adding the following to Makefile.PL ensures that the
> tests dance with the perl that brought them.

[snip]

> If the modules has a t/*.t testbed, then the following is required
> instead: 

[see original; this may have been mangled / miswrapped by my emailer]
> sub MY::test_via_harness {
>     my($self, $perl, $tests) = @_;
>     my $_perl = $perl;
>     $_perl = $Is_Win32 ? "PERL_DL_NONLAZY=1 $perl" : $_perl .= "
>     -Mblib"; "\t$_perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB)
>     -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e '$$ENV{MYPERL}="$perl"; use
>     Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE);
>     runtests @ARGV;' !."$tests\n"; 
> }
> 
> with the various tests invoking $ENV{MYPERL} instead of $^X.  The
> above is not guarenteed to work on VMS.  It needs some well-placed
> double quotes.

Would this do the trick?:


=item test_via_harness

Again, this is *not* MM_Unix.pm sub/method, but based on one contributed
by Stephen Zander (see test_via_script) on the [EMAIL PROTECTED] List.
He notes:

  If the modules has a t/*.t testbed, then this following is
  required instead [...] with the various tests invoking $ENV{MYPERL}
  instead of $^X.

=cut

sub MY::test_via_harness {
    my($self, $perl, $tests) = @_;
    my $_perl = $perl;
    $_perl = $Is_Win32 ? "PERL_DL_NONLAZY=1 $perl" : $_perl .= " -Mblib";
    qq{\t$_perl} .q{ -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) }
       .qq%-e "$$ENV{MYPERL}=qq[$perl];"%
         .qq%-e "use Test::Harness qw(&runtests $$verbose); 
$$verbose=$(TEST_VERBOSE);"%
         .qq%-e "runtests @ARGV;" %
         .qq{ $tests\n};
}


Thanks very much. I have used your improvements in the [Module::]ExoBuild
project I am currently doing. I haven't got a VMS system to test this on
and it's not tested at all yet. OMMV. Just thought it was approximately
what you meant it needed in terms of quoting fixes, also I think it is now
a bit more readable.

   Soren A
-- 

                    --*perlspinr*--
**Helping to consume excess Internet bandwidth since 1996**


Reply via email to