Created
November 18, 2010 04:17
-
-
Save artifactsauce/704621 to your computer and use it in GitHub Desktop.
List installed perl modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Getopt::Long; | |
use ExtUtils::Installed; | |
use List::Util; | |
my %options = (); | |
GetOptions( | |
'table' => \$options{table}, | |
); | |
my $ei = ExtUtils::Installed->new; | |
my $length = List::Util::max( map { length($_) } $ei->modules ); | |
if ( $options{'table'} ) { | |
require Text::SimpleTable; | |
my $table = Text::SimpleTable->new( $length, 10 ); | |
$table->row( 'Module Name', 'Version' ); | |
$table->hr; | |
$table->row( $_, $ei->version($_) ) for $ei->modules; | |
print $table->draw; | |
} | |
else { | |
printf "%-${length}s %s\n", $_, $ei->version($_) for $ei->modules; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment