Sha256: a5595bbdb5d641e4f6f4cb89179de873701ac7d22b4b0a5ca8d3b3fac312f810

Contents?: true

Size: 907 Bytes

Versions: 2

Compression:

Stored size: 907 Bytes

Contents

#!/usr/bin/env perl

# Example: ./is_available.pl Acme::please CPAN

use warnings "all";
use CPAN;

@modules = @ARGV;
unless ($#modules >= 0) {
  print "Usage: uninstall.pl mymodule [mymodule]\n";
  exit 1
}

my @available;
my @unavailable;
foreach my $module (@modules) {
  if (my $module_ref = CPAN::Shell->expand('Module', $module)) {
    my $path = $module_ref->inst_file;
    if ($path && -e $path) {
      #IK# print $module_ref->inst_file, "\n";
      push(@available, $module);
    } else {
      push(@unavailable, $module);
    }
  } else {
    #IK# die "Can't find module: $module";
    push(@unavailable, $module);
  }
}

sub print_contents {
  my($name, @modules) = @_;
  return if $#modules < 0;
  print "$name:\n";
  foreach my $module (@modules) {
    print "  - $module\n";
  }
}

print "--- %YAML:1.0\n";
print_contents 'available', @available;
print_contents 'unavailable', @unavailable;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
automateit-0.71220 helpers/cpan_is_installed.pl
automateit-0.71221 helpers/cpan_is_installed.pl