Skip to content

Instantly share code, notes, and snippets.

@bsdf
Forked from miyagawa/gist:2760426
Created May 22, 2012 23:18
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bsdf/2772279 to your computer and use it in GitHub Desktop.
Save bsdf/2772279 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# Usage: upgrade-cpan.pl 5.14.0 | sort -u | cpanm
use strict;
use File::Find::Rule;
use JSON;
my $old = shift;
my @files = File::Find::Rule->file->name('install.json')->in("$ENV{HOME}/perl5/perlbrew/perls/perl-$old/lib/site_perl/$old");
for my $file (@files) {
my $module = parse_json($file)->{name};
print $module, "\n" if $module;
}
sub parse_json {
open my $fh, shift or die $!;
JSON::decode_json(join '', <$fh>);
}
@jkeroes
Copy link

jkeroes commented Jun 4, 2012

Replacing $ENV{HOME} with $ENV{PERLBREW_ROOT} will support perlbrew installs in non-standard locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment