Skip to content

Instantly share code, notes, and snippets.

@degtyarev-dm
Created June 8, 2012 17:21
Show Gist options
  • Save degtyarev-dm/2896998 to your computer and use it in GitHub Desktop.
Save degtyarev-dm/2896998 to your computer and use it in GitHub Desktop.
Reinstall all perl XS-modules, for example after upgrade perl version(App::cpanminus need).
#!/usr/bin/env perl
use strict;
use File::Find;
my @modules=();
my %hash=();
find(\&wanted,@INC);
sub wanted
{
push @modules, $1 if ($File::Find::name =~ /.*?auto\/([A-Z]([\w\d_\/]+)?)\/[\w\d_]+\.so$/);
}
my @uniq=grep{!$hash{$_}++} @modules;
for my $module (sort @uniq)
{
$module =~s/\//\:\:/g;
system("cpanm --reinstall ".$module);
}
print "[finish]";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment