Skip to content

Instantly share code, notes, and snippets.

@mlbright
Created May 26, 2018 04:07
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 mlbright/aac30664034779f57b78a346a3650eed to your computer and use it in GitHub Desktop.
Save mlbright/aac30664034779f57b78a346a3650eed to your computer and use it in GitHub Desktop.
List all installed perl modules
#! /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