/usr/share/perl5/Genome/Model/Tools/Install/Cpanm.pm is in libgenome-perl 0.06-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | package Genome::Model::Tools::Install::Cpanm;
use strict;
use warnings;
use Genome;
class Genome::Model::Tools::Install::Cpanm {
is => 'Command',
has => [
name => { is => 'Text', is_optional => 1, shell_args_position => 1,
doc => 'tool name', },
],
doc => 'install modules from CPAN'
};
sub execute {
my $self = shift;
my $name = $self->name;
unless ($name) {
$self->error_message("Please specify the name of a tool to install.");
$self->status_message("Checking CPAN for genome modeling tools...");
my $cmd = "curl --progress-bar -L 'http://search.cpan.org/search?query=Genome::Model::Tools&mode=all' | grep class=sr";
my @rows = `$cmd`;
chomp @rows;
my @modules;
for my $row (@rows) {
if ( my ($module) = ($row =~ m{lib/(Genome/Model/Tools/.*\.pm)}) ) {
push @modules, $module;
}
}
if (@modules) {
$self->status_message(join("\n",@modules));
}
else {
$self->status_message("*** no uninstalled modules available ***");
}
return;
}
my @words = map { ucfirst(lc($_)) } split("-", $name);
my $module = 'Genome::Model::Tools::' . join('',@words);
my $path = `which cpanm`;
chomp $path;
unless ($path) {
unless (`which curl`) {
$self->error_message("Your system does not have cpanm or curl installed. Please install one of these to use the genome installer!");
return;
}
$self->status_message("Installing cpanm...");
my $cmd = "curl --progress-bar -L http://cpanmin.us | perl - --sudo App::cpanminus";
system $cmd;
$path = `which cpanm`;
unless ($path) {
$self->status_message("Failed to install cpanm! Attempting direct stream from the Internet...");
$path = "curl --progress-bar -L http://cpanmin.us | perl - --sudo ";
}
}
$self->status_message("searching for $module...");
my $cmd = "$path --info $module";
my $info = `$cmd`;
unless ($info) {
$self->status_message("Failed to find module $module!");
return;
}
my $rv = system "$path --progress-bar $module";
$rv /= 256;
if ($rv) {
$self->error_message("Errors installing $module!");
return;
}
return 1;
}
sub sub_command_sort_position { 9999 }
1;
|