Regarding:

> Subject: Re: name of perl in MakeMaker
> Date: 7 Nov 2002 19:35:21 -0000
> From: [EMAIL PROTECTED] (Soren A)
> Newsgroups: perl.module-authors

Boy did I screw up. I am holding my nose as I type this, because of that
stanky code I posted. I am going to try to cancel the posting on the
nntp.perl.org interface but of course the List itself will still see it,
unfortunately. 

Here is a rectified version of the code in question, and my apologies.


Subject: Re: name of perl in MakeMaker
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?:
---------------------------------8<--------------------------------

=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.  The above is not guarenteed to work on VMS.  It
  needs some well-placed double quotes.

=cut

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

---------------------------------8<--------------------------------


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

 [[s/not tested at all/tested to a limited degree/]]

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.

It ran correctly in Cygwin bash; the '$'s are escaped correctly for that
shell. The module package I tested it on is Compress::Zlib v1.19.

Here's what it created in 'Makefile':
---------------------------------8<--------------------------------
test_dynamic :: pure_all
        $(FULLPERLRUN) -Mblib -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) 
-I$(PERL_LIB) \
          -e "\$$ENV{MYPERL} = q[$(FULLPERLRUN)];" \
          -e "use Test::Harness qw(&runtests \$$verbose); \$$verbose = 
$(TEST_VERBOSE);" \
          -e "runtests @ARGV;" $(TEST_FILES)

# [...]

test_static :: pure_all $(MAP_TARGET)
        ./$(MAP_TARGET) -Mblib -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) 
-I$(PERL_LIB) \
          -e "\$$ENV{MYPERL} = q[./$(MAP_TARGET)];" \
          -e "use Test::Harness qw(&runtests \$$verbose); \$$verbose = 
$(TEST_VERBOSE);" \
          -e "runtests @ARGV;" $(TEST_FILES)

---------------------------------8<--------------------------------

That LOOKS much more like what we want, at least?

   Soren A

-- 
  conway: unit of mind expansion.
One Conway == ~20 lines of Perl code found in
$CPAN/authors/id/D/DC/DCONWAY, which gives the
sensation of your brain being wrapped around a
brick, with kiwi juice squeezed on top.
        -- Ziggy (via Schwern)


Reply via email to