Skip to content

Instantly share code, notes, and snippets.

@kits
Created November 9, 2010 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kits/668933 to your computer and use it in GitHub Desktop.
Save kits/668933 to your computer and use it in GitHub Desktop.
extract "fatpacked" module in cpanm.
#!perl
use strict;
use warnings;
use PadWalker qw(peek_sub);
require 'path/to/cpanm';
my $extract_to = 'lib';
my $fatpacked = peek_sub($INC[0])->{'%fatpacked'};
use File::Path qw(make_path);
use File::Basename;
for my $path (keys %$fatpacked) {
make_path dirname "$extract_to/$path";
open my $fh, '>', "$extract_to/$path" or die "cannot open $path: $!";
print $fh $fatpacked->{$path};
close $fh;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment