Created
May 26, 2018 04:07
-
-
Save mlbright/aac30664034779f57b78a346a3650eed to your computer and use it in GitHub Desktop.
List all 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/perl -l | |
use strict; | |
use warnings; | |
use File::Find; | |
my %seen; | |
for my $inc (@INC) { | |
next unless (-d $inc); | |
find(sub { | |
my $file = $File::Find::name; | |
if ($file =~ /\.pm$/) { | |
my $module = substr($file, length($inc)+1); | |
$module =~ s/.pm$//; | |
$module =~ s{[\\/]}{::}g; | |
$seen{$module}++; | |
} | |
}, $inc); | |
} | |
for my $module (sort keys %seen) { | |
print "$module"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment