App-perlall

 view release on metacpan or  search on metacpan

script/perlall  view on Meta::CPAN

Uninstalls the given version(s).

=cut


sub uninstall
  :Help('sudo rm /usr/local/bin/perl<arg> and its archlibs')
{
  my $c = shift;
  for my $p (@{$c->stash->{perlall}}) {
    my $bindir = $c->config->{PERLALL_BINDIR};
    $bindir = "/usr/local/bin" unless $bindir;
    $p = basename($p);
    $c->_fail("$bindir/$p does not exist") unless -e "$bindir/$p";
    my $pq = $p;
    $pq =~ s/([\@\$\%])/\\$1/;

    my $archlib = `$bindir/$pq -MConfig -e'print \$Config{archlibexp}'`;
    $archlib = `$bindir/$pq -MConfig -e'print \$Config{archlib}'` unless $archlib;
    my $sitearch = `$bindir/$pq -MConfig -e'print \$Config{sitearchexp}'`; # may be empty
    if ($c->options->{dryrun} or (-f "$bindir/$p" and -d $archlib)) {
      $c->_system0("sudo","rm","-rf", "$bindir/$p", $archlib, $sitearch);
    } else {
      $c->_fail("$p archlib $archlib did not exist");
    }
    my $root = $c->config->{PERLALL_BUILDROOT};
    if (-d "$root/inst-$p") {
      $c->_system1("rm","-rf","$root/inst-$p");
    }
    # XXX ask
    if (-d "$root/build-$p") {
      $c->_log("rm","-rf","$root/build-$p");
    }
    print "perl$p uninstalled\n";
  }
}

=item B<smoke> [OPTIONS] perl<version><suffix> [ branch|from ]

Same as C<build>, but reports the testresults to the smokers mailing list.

C<from> may be a wildcard for multiple smoke branches, as C<smoke-me/*>.

Description and OPTIONS see L</build>.

=cut


sub _smoke
{
  my ($c, $p, $from, @j) = @_;
  return "unimplemented";
}

=item B<bench> [OPTIONS] <version><suffix> [ how ]

Runs a short perl-core benchmark, and optionally a third-party script,
automatically until the benchmark statistically stabilizes.

Rejects statistical outliers, heavy load, and does the
iterations up to 2 seconds on shorter scripts.

Tested are array access, hash access, s///, in a tak with
recursion and tail-recursion without IO to prevent too many
external influences, though perl typically shines on IO.

=cut


sub bench
  :Help('NYI')
{
  my $c = shift;
  # http://blogs.perl.org/users/rurban/2011/11/on-simple-benchmarks.html
  return "unimplemented";
}


=item B<init> [perl<version><suffix> [--deps] [<modules>...]]

=item perlall="5.*" B<init> [<modules>...]

Installs and updates basic CPAN modules.

Default: C<init-modules> in F<~/.perlall>
   YAML DBI DBD::SQLite CPAN::SQLite Devel::Platform::Info \
   Params::Util Bundle::CPANReporter2 \
   B::Flags Opcodes  Math::Round Params::Classify `cat ~/Perl/B-C/t/top100` \
   Bundle::CygwinVendor YAML::XS DBIx::Class SQL::Abstract Module::Find Mouse \
   MouseX::Types Task::Kensho

Specific Options:

  --cpan=-MCPAN
    Default: C<cpan>=C<cpan> or C<cpanm> in F<.perlall>
  --deps    scan blib/lib and t for modules with ack

=cut

sub init
  :Help('Installs and updates basic CPAN modules')
{
  my $c = shift;
  $c->addopts( "cpan=s", "deps" );
  my @argv = @{$c->argv};
  my $mods = @argv ? join(" ",@argv) : $c->config->{'init-modules'};
  if (!@argv and $mods =~ /`(.+?)`/) { # expand `` in init-modules
    my $sh = `$1`;
    $mods =~ s/`(.+?)`/$sh/;
  }
  if ($c->options->{deps}) {
    my $ack = q(ack -ho '(^\s*|\{\s*)(use|require) ([\w:]+);' blib/lib t | perl -lpe's/^\s*(\{|;|use|require)\s*//g;s/;?\s*\$//;' | sort -u);
    $mods = `$ack`;
    $mods = join(" ",split(/\n/, $mods));
    return "no --deps found" unless $mods;
  }
  return "missing config init-modules" unless $mods;
  my $cpan = $c->options->{'cpan'};
  $cpan = $c->config->{'cpan'} unless $cpan;
  $c->options->{verbose} = 1;
  for my $p (@{$c->stash->{perlall}}) {



( run in 0.393 second using v1.01-cache-2.11-cpan-96521ef73a4 )