2 ################################################################################
4 # soak -- Test Perl modules with multiple Perl releases.
6 # Original Author: Paul Marquess
8 ################################################################################
12 # $Date: 2006/01/14 18:07:57 +0100 $
14 ################################################################################
16 # Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
17 # Version 2.x, Copyright (C) 2001, Paul Marquess.
18 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
20 # This program is free software; you can redistribute it and/or
21 # modify it under the same terms as Perl itself.
23 ################################################################################
29 use ExtUtils::MakeMaker;
32 use List::Util qw(max);
35 my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.08_01 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };
39 my $MAKE = $Config{make} || 'make';
42 make => $Config{make} || 'make',
45 GetOptions(\%OPT, qw(verbose make=s mmargs=s@)) or pod2usage(2);
47 $OPT{mmargs} = [''] unless exists $OPT{mmargs};
49 my @GoodPerls = @ARGV ? @ARGV : FindPerls();
50 my $maxlen = max(map length, @GoodPerls) + 3;
51 my $mmalen = max(map length, @{$OPT{mmargs}});
52 $maxlen += $mmalen+3 if $mmalen > 0;
54 # run each through the test harness
55 my(@good, @bad, $total);
57 # prime the pump, so the first "make realclean" will work.
58 runit("$^X Makefile.PL") && runit("$MAKE realclean")
59 or die "Cannot run $^X Makefile.PL && $MAKE realclean\n";
61 for my $perl (@GoodPerls) {
62 for my $mm (@{$OPT{mmargs}}) {
63 my $config = $mm =~ /\S+/ ? " ($mm)" : '';
64 my $prefix = $verbose ? "$perl$config -- " : '';
65 print "Testing $perl$config " . ('.' x ($maxlen - length($perl.$config)));
67 my $ok = runit("$perl Makefile.PL $mm") &&
68 # runit("$perl Makefile.PL --with-apicheck") &&
73 push @good, [$perl, $mm];
74 print "${prefix}ok\n";
77 push @bad, [$perl, $mm];
78 print "${prefix}not ok\n";
81 runit("$MAKE realclean");
85 if ($verbose && @bad) {
86 print "\nFailed with:\n", map " $_\n", @bad;
88 print "\nPassed with ", scalar @good, " of $total versions/configurations.\n\n";
93 # TODO -- portability alert!!
96 print "\n Running [$cmd]\n" if $verbose;
97 my $output = `$cmd 2>&1`;
98 $output = "\n" unless defined $output;
100 print "\n Output\n$output\n" if $verbose || $?;
102 warn " Running '$cmd' failed: $?\n";
110 # TODO -- need to decide how far back we go.
111 # TODO -- get list of user releases prior to 5.004
112 # TODO -- does not work on Windows (at least)
114 # find versions of Perl that are available
115 my @PerlBinaries = qw(
120 5.004 5.00401 5.00402 5.00403 5.00404 5.00405
121 5.005 5.00501 5.00502 5.00503 5.00504
123 5.7.0 5.7.1 5.7.2 5.7.3
124 5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6
128 print "Searching for Perl binaries...\n";
129 my $mm = MM->new( { NAME => 'dummy' });
130 my @path = $mm->path;
133 # find_perl will send a warning to STDOUT if it can't find
134 # the requested perl, so need to temporarily silence STDOUT.
135 tie *STDOUT, 'NoSTDOUT';
137 for my $perl (@PerlBinaries) {
138 if (my $abs = $mm->find_perl($perl, ["perl$perl"], \@path, 0)) {
139 push @GoodPerls, $abs;
145 print "\nFound:\n", (map " $_\n", @GoodPerls), "\n";
153 our @ISA = qw(Tie::Handle);
155 sub TIEHANDLE { bless \(my $s = ''), shift }
163 soak - Test Perl modules with multiple Perl releases
167 soak [options] [perl ...]
169 --make=program override name of make program ($Config{make})
170 --mmargs=options pass options to Makefile.PL (multiple --mmargs possible)
175 Version 3.x, Copyright (c) 2004-2006, Marcus Holland-Moritz.
177 Version 2.x, Copyright (C) 2001, Paul Marquess.
179 Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
181 This program is free software; you can redistribute it and/or
182 modify it under the same terms as Perl itself.
186 See L<Devel::PPPort>.