Skip to content

Instantly share code, notes, and snippets.

@miyagawa
Created May 21, 2012 03:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save miyagawa/2760426 to your computer and use it in GitHub Desktop.
Save miyagawa/2760426 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# Usage: upgrade-cpan.pl 5.14.0 | sort -u > /tmp/modules.txt
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)->{module};
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