Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 57 lines (46 sloc) 1.277 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#!/usr/bin/perl

# Copyright 2004, Paul Johnson (pjcj@cpan.org)

# This software is free. It is licensed under the same terms as Perl itself.

# The latest version of this software should be available from my homepage:
# http://www.pjcj.net

use strict;
use warnings;

use Getopt::Long;

my $Options =
{
    dry_run => 0,
    ignore_failure => 0,
    version => [],
};

sub get_options
{
    die "Bad option" unless
    GetOptions($Options, # Store the options in the Options hash.
               qw(
dry_run!
ignore_failure!
version=s
));
    $Options->{version} =
        [ qw( 5.6.1 5.6.2 5.8.0 5.8.1 5.8.2 5.8.3 5.9.0 5.9.1 ) ]
        unless @{$Options->{version}};
    $Options->{version} =
        [ grep eval { !system "perl$_ -v" }, @{$Options->{version}} ];
}

sub sys
{
    my ($command) = @_;
    print "$command\n";
    return if $Options->{dry_run};
    my $ret = system $command;
    die "command failed: $?" if $ret && !$Options->{ignore_failure};
}

get_options;
my $command = "@ARGV" or die "Usage: $0 [-v version] command\n";

for my $v (@{$Options->{version}})
{
    my $perl = "perl$v";
    sys "$perl Makefile.PL";
    sys "make";
    sys $command;
}
Something went wrong with that request. Please try again.