Created
July 16, 2012 15:12
-
-
Save smeghead/3123259 to your computer and use it in GitHub Desktop.
check missing modules.
This file contains 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 utf8; | |
use Data::Dumper; | |
die 'no argument.' if scalar @ARGV < 1; | |
my $check_path = $ARGV[0]; | |
my $uses = `fgrep -r 'use ' $check_path | sed -e 's/.*use \\([A-Z][a-zA-Z0-9:]\\+\\).*/\\1/' | grep -v '^/' | sort | uniq`; | |
my @modules = split /\s/, $uses; | |
print "#-- missing modules list --\n"; | |
for my $module (@modules) { | |
chomp $module; | |
eval("use $module;"); | |
if ($@) { | |
print "cpanm $module\n"; | |
} | |
} | |
print "#--------------------------\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment