Created
May 4, 2010 14:05
-
-
Save kurain/389443 to your computer and use it in GitHub Desktop.
to filtering cpan package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use UNIVERSAL::require; | |
my @installed; | |
my @not_installed; | |
while (<>) { | |
chomp; | |
next unless $_ =~ /^perl-/; | |
next if $_ =~ /Sub-Exporter/; | |
my @elms = split /-/, $_; | |
next if @elms < 4; | |
my @names = @elms[1..($#elms-2)]; | |
my $package = join "::", @names; | |
printf STDERR "%s\n ", $_; | |
printf STDERR "%s ... ", $package; | |
my $res = `cpanv $package`; | |
if ( $res ) { | |
print STDERR "[OK installed] \n"; | |
push @installed, $package; | |
} else { | |
print STDERR "[NOTEICE not installed] \n"; | |
print STDERR $@; | |
printf "%s\n", $package; | |
push @not_installed, $package; | |
} | |
} | |
warn sprintf "%d package installed\n" , scalar @installed; | |
warn sprintf "%d package not installed\n" , scalar @not_installed; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use UNIVERSAL::require; | |
my $module = $ARGV[0]; | |
return unless $module; | |
$module->require; | |
if ( $module->VERSION ) { | |
printf "%s\n", $module->VERSION; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment