Skip to content

Instantly share code, notes, and snippets.

@xaicron
Created March 14, 2010 10:13
Show Gist options
  • Select an option

  • Save xaicron/331904 to your computer and use it in GitHub Desktop.

Select an option

Save xaicron/331904 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use ExtUtils::MakeMaker;
use Config;
use File::Find;
my $max = 0;
my $data = +{};
for my $lib (@INC) {
next if $lib eq '.';
next unless -d $lib;
$lib =~ s|\\|/|g;
find sub {
if ($_ =~ /\.pm$/) {
my $path = $File::Find::name;
my $version = MM->parse_version($path) || '';
(my $module = $path) =~ s|$lib/||;
$module =~ s|\.pm$||;
$module =~ s|$Config{archname}/?||o;
$module =~ s|/|::|g;
$max = length $module < $max ? $max : length $module;
$data->{$module} ||= "$version";
}
}, $lib;
}
for my $module (sort keys %$data) {
printf "%-*s : %s\n", $max, $module, $data->{$module};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment