@@ -2,20 +2,38 @@ use 5.010;
22use strict;
33use warnings;
44use ExtUtils::MakeMaker;
5+ use Config;
56
6- sub MY ::postamble {
7+ # Get the filename of the Perl interpreter running this. Modified from perlvar.
8+ # The -x test is for cygwin or other systems where $Config{perlpath} has no
9+ # extension and $Config{_exe} is nonempty. E.g., symlink perl->perl5.10.1.exe.
10+ # There is no "perl.exe" on such a system.
11+ sub get_perl_filename {
12+ my $secure_perl_path = $Config {perlpath };
13+ if ($^O ne ' VMS' ) {
14+ $secure_perl_path .= $Config {_exe }
15+ unless (-x $secure_perl_path ) ||
16+ ($secure_perl_path =~ m /$Config {_exe}$ / i );
17+ }
18+ return $secure_perl_path ;
19+ } # get_perl_filename()
20+
21+ my $secure_perl_path = get_perl_filename();
22+
23+ sub MY ::postamble { # TODO also handle Windows nmake syntax (SET vs. export)
724 return <<EOT ;
825authortest:
926\t RELEASE_TESTING=1 prove -l xt"
1027
1128testhere: # Run the tests from lib rather than blib
12- \t export PERLPP_CMD="perl -Ilib bin/perlpp"; \\
13- \t perl -Ilib -e 'use Test::Harness "runtests"; runtests \@ ARGV;' -- t/*.t
29+ \t "$secure_perl_path " -Ilib -e 'use Test::Harness "runtests"; runtests \@ ARGV;' -- t/*.t
1430
15- testpacked: pack # Test the packed version
16- \t export PERLPP_NOUSE =1 PERLPP_CMD="perl blib/perlpp"; \\
17- \t perl -e 'use Test::Harness "runtests"; runtests \@ ARGV;' -- t/*.t
31+ testpacked: pack # Test the packed version.
32+ \t PERLPP_NOUSE =1 PERLPP_PERLOPTS=" blib/perlpp" \\
33+ \t " $secure_perl_path " -Ilib -e 'use Test::Harness "runtests"; runtests \@ ARGV;' -- t/*.t
1834EOT
35+ # Note: testpacked uses -Ilib so that I don't have to conditionally
36+ # use Text::PerlPP in t/lib/PerlPPTest.pm.
1937} # postamble
2038
2139WriteMakefile(
@@ -32,8 +50,17 @@ WriteMakefile(
3250 },
3351 BUILD_REQUIRES => {
3452 ' App::FatPacker' => ' 0' ,
53+ },
54+ TEST_REQUIRES => {
55+ ' Capture::Tiny' => ' 0' ,
56+ ' Carp' => ' 0' ,
57+ ' Config' => ' 0' ,
58+ ' File::Spec' => ' 0' ,
3559 ' IPC::Run3' => ' 0' ,
60+ ' rlib' => ' 0' ,
3661 ' Test::More' => ' 0' ,
62+ ' Text::ParseWords' => ' 0' ,
63+ ' Text::Diff' => ' 0' , # for t/03-idempotency.t
3764 },
3865 PREREQ_PM => {
3966 ' Getopt::Long' => ' 2.5' , # Per issue #17
0 commit comments