Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use autodie qw/:all/;
my $as = shift
or die "Usage: $0 <perl-version> [install args]";
my @args = @ARGV;
# trailing "t" means do threads
my @threads = ( $as =~ /t$/ ) ? (qw/-D usethreads/) : ();
$as =~ s/^5\.//;
my $perl = "5.$as";
$perl =~ s/t$//; # strip trailing "t" if any
# to be force installed
my @problem_modules = qw(
Module::Build
);
my @to_install = qw(
Task::BeLike::DAGOLDEN
);
my @no_man = qw/-D man1dir=none -D man3dir=none/;
unless ( -d "$ENV{HOME}/perl5/perlbrew/perls/$as" ) {
# install perl and lock it down
system( qw/perlbrew install -j 9 --as/, $as, $perl, @threads, @no_man, @args );
# bootstrap cpanminus
system( qw/perlbrew exec --with/, $as, qw/cpan App::cpanminus/ );
# let's avoid any pod tests when we try to install stuff
system( qw/perlbrew exec --with/, $as, qw/cpanm TAP::Harness::Restricted/ );
local $ENV{HARNESS_SUBCLASS} = "TAP::Harness::Restricted";
# some things need forcing
system( qw/perlbrew exec --with/, $as, qw/cpanm -f/, @problem_modules );
}
local $ENV{HARNESS_SUBCLASS} = "TAP::Harness::Restricted";
# now install the rest
system( qw/perlbrew exec --with/, $as, qw/cpanm/, @to_install );
# repeat to catch any circularity problems
system( qw/perlbrew exec --with/, $as, qw/cpanm/, @to_install );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment